'Change tax class if field in checkout is not empty in WooCommerce
I am using standard tax rate in WooCommerce but if I want to sell to business customer in other country, then VAT rate must be lower. How can I change tax to "Reduced rate" if field with ID "billing_ic" is filled?
I am tried this, but it does not work:
function wc_different_rate( $tax_class, $product ) {
$checkout = WC()->checkout();
$billing_ic = $checkout->get_value( 'billing_ic' );
if ($billing_ic == '') {
$tax_class = 'standard-rate';
}
else {
$tax_class = 'reduced-rate';
}
return $tax_class;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
