wordpress - 基于小计金额的 Woocommerce 税
问题描述
我需要根据小计金额应用不同的税级而不是 WooCommerce 标准税级。如果小计金额小于特定值,则对购物车应用不同的税种。我已将以下代码应用于我的孩子theme's function.php
。但这也行不通。任何帮助,将不胜感激。
add_filter( 'woocommerce_product_tax_class', 'big_apple_get_tax_class', 1, 2 );
function big_apple_get_tax_class( $tax_class, $product ) {
if ( WC()->cart->subtotal <= 110 )
$tax_class = 'Zero Rate';
return $tax_class;
}
解决方案
推荐阅读
- python - 防止 pip 缓存包
- powershell - 如何终止不是通过“启动”活动启动的 Chrome 应用程序,而是从另一个应用程序(如 Powershell)启动的?
- javascript - 如何跟踪表单中的焦点元素
- amazon-web-services - 在 AWS 控制台中查看 Kinesis Stream 的所有使用者的方法
- vbscript - 处理 MSXML 超时
- java - Java:ZipOutputStream 将数据块压缩为单个 zip 文件
- regex - 固定长度字符串的正则表达式,以多个不同长度的单词开头
- c# - WCF将十进制序列化为具有2个十进制精度的字符串
- wso2 - WSO2 APIM 2.6.0 使用 RestAPI 发布 API
- c# - 始终运行 Web 服务