-
-
Save aadityajs/8235774 to your computer and use it in GitHub Desktop.
Apply tax based on subtotal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_product_tax_class', 'big_apple_get_tax_class', 1, 2 ); | |
function big_apple_get_tax_class( $tax_class, $product ) { | |
global $woocommerce; | |
if ( $woocommerce->cart->subtotal <= 110 ) | |
$tax_class = 'Zero Rate'; | |
return $tax_class; | |
} | |
?> |
This worked for me
Hi,
your formula is working for me but I also want to set state too along with subtotal. How I can do this ? I want to use tax class as Zero if customer is from New York and subtotal is <= 110.
Any help ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added in wp-content/plugins/woocommerce/includes/class-wc-cart.php