I want to change the tax class (or zero taxes) of a purchase if a field is filled in the checkout, which would be the State Registration, if the company or individual has a state registration will not pay a certain tax, then zero . I tried in some ways and without success.
One of the things I tried to do was to do a woocommerce_product_tax_class:
$checkout = WC()->checkout();
$billing_ie = $checkout->get_value( 'billing_ie' );
if ($billing_ie == '') {
$tax_class = 'Zero Rate';
}
else {
$tax_class = 'ICMS';
}
return $tax_class;
If someone knows a plugin for new state ICMS rule of Brazil also helps me, because that's what I'm doing.