The EU VAT Assistant doesn’t offer such feature out of the box, you will need to write a customisation for that purpose. This would consist of two parts:
1. A frontend script, to detect when the customer fills the VAT number and make the company number required “on the fly”.
2. A backend validation, to return an error if the VAT number is filled and the company number is not.
For #1, you can look into file woocommerce-eu-vat-assistant/src/js/frontend/frontend.js
, around line 262. That will show you how the EU VAT Assistant marks the VAT number field as “required” on the frontend, for example when the customer enters a company name.
For #2, you can look into file woocommerce-eu-vat-assistant/src/plugin-main.php
, in the following methods:
– is_eu_vat_number_required()
shows how the plugin checks if the VAT number field is required.
– Line 1525 is where the plugin checks if the VAT number is required. That function is called by an event handler hooked to action woocommerce_checkout_process
.
With the above information, your developer should be able to add a “reverse check” (i.e. instead “VAT number required when company is entered”, implement “company required when VAT number is entered”).