VAT is calculated and applied to each order by WooCommerce itself. Our plugin only sets a VAT exemption flag when the VAT number is valid, and such flag is global (i.e. it applies to the whole order).
You can manipulate the VAT exemption flag by writing a filter like the following:
add_filter('wc_aelia_eu_vat_assistant_customer_vat_exemption', function($apply_exemption, $vat_country, $vat_number, $vat_number_validated, $raw_vat_validation_response) {
// Write custom logic to determine if VAT exemption should be applied
return $apply_exemption;
}, 10, 5);
In that filter, you can decide to remove the VAT exemption, even though the VAT number is valid. Again, this applies to the whole order (this is by design in WooCommerce).
If you need to apply a VAT exemption only to some specific products, then you will have to write your own custom logic. For example:
- Keep track of the fact that a customer is exempt, in the filter described above.
- In the same filter, return false, so that the VAT exemption is not applied.
- Write a filter to change the tax class for the VAT exemption (see example: https://www.ads-software.com/support/topic/change-tax-rates-or-tax-class-in-checkout-ajaxphp/). In your filter, you can check if the customer should be exempt from VAT (information that you collected at step #1), and change the tax class to “Zero Rate” for the appropriate product.
The result will be that the customer won’t be exactly “exempt”, but that some products will not have VAT applied to them.
-
This reply was modified 7 years, 11 months ago by Diego.
-
This reply was modified 7 years, 11 months ago by Diego.