Adding EU VAT number field on the checkout page can be an important thing to do in WooCommerce store, especially when you sell to the business owners. In this article, I’ll show you how to display that field and how to add EU VAT number validation.
If you are selling in the European Union, probably you know that it demands to respect some legal aspects. One of the most important things is to support the VAT identification number (known as VAT Number or EU VAT). Without it, you can’t issue a valid invoice. WooCommerce doesn’t cover it, so you have to use some plugins.
Add EU VAT field with Flexible Checkout Fields
In this example, I’ll use the free version of Flexible Checkout Fields. It’s the easiest way to add the EU VAT field in WooCommerce. Flexible Checkout Fields is very well rated plugin with over 50,000 store using it daily.
Add EU VAT number field in WooCommerce Checkout
First, we have to add a field to validate it. After you install and activate Flexible Checkout Fields plugin, go to WooCommerce → Checkout Fields and in Add New Field section choose Single Line Text. Next, input a label and click on Add Field button.
How to add EU VAT number validation in WooCommerce
When you have your VAT field, time to add proper validation. That means that WooCommerce will check if customers’ VAT number is valid based on EU regulations. In this case, I have to make my own validation, because Flexible Checkout Fields has only email, phone number and postal code validation built in its core.
To add new validation to WooCommerce you have to add code that is displayed below to your functions.php file.
When you have your functions.php file updated, you can add a validation. Again, go to WooCommerce → Checkout Fields, and see the field added before. In the Validation section, you should see your new custom validation.
Choose your validation and click on Save Changes.
Let’s try it out.
If I’ll enter not a valid EU VAT number field on the checkout page, I should see a proper error notice.
If the EU VAT number is correct, the order will be placed without any problems.Different ways to add EU VAT number validation in WooCommerce
As you can see, the way I presented is for more advanced customers. But there is another solution. You could use Flexible Invoices plugin, that has build validation. Check out our article, where you can find more information about 3 easy ways to add a VAT number field in WooCommerce. Thanks to the premium Flexible Invoices WooCommerce plugin's functionalities you may use VIES validation of VAT EU numbers when selling digital products. You can read how to invoice in the European Union using WooCommerce to see how the plugin in action.