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 optional depending on the customer's country.

For EU customers, it is also possible to 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, only accepting them once you've manually verified their information.

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.

You can prevent a company from registering or checking out unless they have a valid VAT number. Furthermore, you can enable a tax exemption and show prices without taxes for users who have a valid VAT number.

Checkout failure due to an 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 you to remove 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 "Accessories" 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 optionally be added to registration, billing, checkout, or all of the above. See the documentation article on "Registration" for more details.

Configuration of the 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 appear on invoices as well.

VAT Validation at Checkout #

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

Validate VAT at checkout

This means it can apply VAT exemptions and remove VAT from the cart of guest users when they check out 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 occasionally be unavailable due to issues such as too many requests, maintenance, etc.

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

Email received by the website admin when VIES validation fails due to issues with the VIES server.

If you would like to turn off this behavior, add 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...". Occasionally, these can be a normal result, but if they occur constantly for all VAT checks, it means the site or server is generally unable to contact the VIES server for some reason.

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

add_filter('b2bking_vies_use_curl','__return_true');

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

Useful Code Snippets #

Snippet 1: Disable VIES for specific EU countries

It is possible to exclude certain countries from VIES validation. To do so, 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 this, 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