Last active
January 5, 2021 18:35
-
-
Save mikejolley/5568708 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
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; | |
} |
Hi,
Is this code still valid? And, is this editable to be active online in one country. For example, if your in the Netherlands and you sell a certain product above the amount of 10.000 euro, the Tax (called BTW in dutch) can be deducted. (these are new rules/laws)
Hi! I have updated the code in my fork: https://gist.github.com/fylgjur/fb32f8549dec158c754d0ac2c4283fac
To include the updated filter woocommerce_product_get_tax_class
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Isn't
woocommerce_product_tax_class
deprecated in favor ofwoocommerce_product_get_tax_class
?