我正在尝试添加一个过滤器以吸引商业,根据购物车的数量计算税额,只有当物品运到纽约时,订单> 110 $不纳税,订单<110 $并运送到纽约州应该支付8,865%的税 . 我发现这个代码在某个地方,但不确定是否有效,无论在哪里使用它 .
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;
}
Apreciatte任何帮助!
1 回答
在wp-content / plugins / woocommerce / includes / class-wc-cart.php中添加