1

I need to apply a different tax class rather than the WooCommerce standard tax class based on the subtotal amount. if the subtotal amount is less than a particular value, then apply a different tax class to the cart. I have applied the below code to my child theme's function.php. But it won't work either. Any help would be appreciated.

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;
} 
Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51

0 Answers0