We designed and tested the EU VAT Assistant with a standard WooCommerce installation, and that’s the scope of its compatibility. In a standard WooCommerce setup, the billing fields are always visible, even when the cart total is zero, therefore the EU VAT Assistant adds its fields following the same basic logic. This is by design, and it’s not a limitation (in fact, the behaviour can be customised easily, as described below).
We’re not planning to add a feature to hide the fields when the cart total is zero, both because this can be done with a snippet (just like the ones you mentioned), and because the EU VAT Assistant is in maintenance mode, pending its retirement.
If you wish, you can do that by hooking into the filter used by the EU VAT Assistant, and removing those fields when needed. You can do that in two ways:
1. Write a filter for the hooks wc_aelia_eu_vat_assistant_show_checkout_field_vat_number
and wc_aelia_eu_vat_assistant_show_checkout_field_self_certification
, and return false when the cart total is zero.
2. Write a filter for the hook woocommerce_checkout_fields
, with a low priority (e.g. 9999). In the filter, check if the cart total is zero and, if it is, remove the fields by calling unset($fields['billing']['vat_number'])
and $fields['billing']['customer_location_self_certified'])
.
Either approach will allow you to customise the fields being displayed on the checkout page, just like the plugins and code snippets you mentioned do.
Note
For the benefit of other readers, I would like to add that the title of this thread is misleading. The EU VAT Assistant is 100% compatible with free orders. The fact that it shows its field even when an order has a total of zero is by design. The behaviour can be customised with a simple code snippet.
-
This reply was modified 3 years ago by
Diego. Reason: Added link to the development plans FAQ for the EU VAT Assistant