【发布时间】:2021-08-18 01:44:42
【问题描述】:
我尝试使用此代码根据购物车总计获取不同的税种,但它没有在“总计”列中更新。
add_filter( 'woocommerce_product_get_tax_class', 'big_apple_get_tax_class', 1, 2 );
function big_apple_get_tax_class( $tax_class, $product ) {
if ( WC()->cart->subtotal < 1000 )
$tax_class = 'Tax-5%';
elseif ( WC()->cart->subtotal >= 1000 )
$tax_class = 'Tax-12%';
return $tax_class;
【问题讨论】:
标签: php wordpress woocommerce hook