VAT and VIES Validation

Overview #

B2BKing introduces a system through which companies can provide their VAT number during registration or checkout. The VAT number can be required or not required depending on the customer's country.

For EU customers, it is possible to also enable VAT number validation through the official European VIES system API.

Note: You can use B2BKing for shops in any country, and it also works well with GST, Sales Tax, and any other tax system around the world. This VAT validation is only an optional feature for your customers in EU countries. In other countries, you can use B2BKing's manual approval system, and require customers to provide their tax number or upload documents, and only accept customers once you've manually verified them.

VIES Validation through Official API #

The VAT number validation system works through the European (ec.europa.eu) API, which can verify with certainty whether a company's VAT number is valid.

It is possible to not allow a company to register or checkout unless they have a valid VAT number. Furthermore, you can enable a tax exemption and show prices without taxes for users that have a valid VAT number.

Failure to checkout due to invalid VAT number
Tax exemption for B2B users in specific countries, based on having a VIES-validated VAT number.

The tax exemption system is flexible and allows removing tax for specific users or groups, in specific countries. It can also be set for specific products or categories only.

Examples

Here are a few examples of what can be achieved:

  • Remove all tax for users with a valid VAT number
  • Remove tax on "Accesories" for users in Poland and Italy with a valid VAT number
  • Remove tax on a specific product for any users in Austria with a valid VAT number
  • Remove tax on product and shop pages, but have the VAT be paid during cart and checkout

VAT Field Options #

The VAT field can be optionally added to registration, billing, checkout, or all of the above. See the documentation article on "Registration" for more details.

Configuration of VAT field in B2BKing -> Registration Fields.

Options include making the field required, or selecting only specific countries that can see the field. It is also possible to add the field to billing, which will make VAT numbers also show on invoices.

VAT Validation at Checkout #

It is also possible to enable VAT validation during checkout, or checkout registration. To do this, you would need to go to B2BKing -> Settings -> Other and enable the "Validate VAT button at checkout" option.

Validate VAT at checkout

This means that it can apply VAT Exemptions and remove VAT from the cart of guest users when they checkout without an account, or when they register for the first time.

Configuring VAT and Tax Exemptions #

To configure tax exemptions and/or show prices without tax, please see our dedicated documentation article on exemptions.

VIES Timeouts #

The European VIES validation system may be occasionally unavailable, encountering issues such as too many requests, maintenance, etc.

In those cases, B2BKing by default will allow registrations / checkout, but will notify the website admin about the situation, so it can be checked manually.

Email received by website admin when VIES validation fails for reasons that have to do with the VIES server.

If you would like, you can turn off this behaviour, by adding the following snippet to your site:

add_filter('b2bking_allow_vat_timeouts_unavailable_errors','__return_false');

VIES Connection Error & Fix #

Some sites may see emails with errors such as "Could not connect to host" or "SOAP-ERROR: Parsing WSDL: Couldn't load from...". On occasion, these could be a normal result, but if these errors are constant for all VAT checks, it means the site / server is generally not able to contact the VIES server for some reason.

For these cases, B2BKing has an alternative VIES connection way that can be enabled by adding this PHP code snippet to the site:

add_filter('b2bking_vies_use_curl','__return_true');

The code enables B2BKing to contact the server via cURL and can solve such connection issues in many cases.

Useful Code Snippets #

Snippet 1: Disable VIES for specific EU countries

It is possible to exclude certain countries for VIES validation. To do it, add the following PHP code snippet to your site, and remove the countries you do not want validation for:

add_filter('b2bking_country_list_vies', function($countries){
	return array('AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'EL', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE');
}, 10, 1);

Snippet 2: Force default VAT country

By default, customers need to enter the country prefix together with the VAT number (e.g. IT1234... or DE1234...). You can also set a default prefix, so that customers can enter their number directly, making the prefix optional. To do it, you can add the following snippet:

add_filter('b2bking_set_default_prefix_vat', function($prefix){
	return 'IT'; // replace IT with any country prefix
}, 10, 1);

Powered by BetterDocs