Adding an EU VAT number field on the checkout page can be an important thing to do in the WooCommerce store, especially when you sell to business owners. In this article, I’ll show you how to display that field and how to add EU VAT number validation in the WooCommerce checkout!
Have you ever checked if the buyer's VAT EU number is correct? It's quite annoying to check it manually, isn't it?
Wouldn't be great to add the EU VAT number field with the validation at the same time directly in the WooCommerce checkout form? Of course, it would save you time and help speed up processing orders. Read more to learn a method to do that!
Table of contents
- Show the EU VAT number field in the WooCommerce checkout form
- Add EU VAT number validation & example
- Summary & Different ways to add EU VAT number validation in WooCommerce
If you are selling in the European Union, probably you know there are certain legal aspects you must follow. 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.
Show the EU VAT number field in the WooCommerce checkout form
WooCommerce doesn’t add or cover EU VAT validation. So you have to use a plugin to handle that. Follow the steps below to add the field with the validation.
Get the Flexible Checkout Fields plugin for WooCommerce
👉🏼 In my case, I’ll use the free version of Flexible Checkout Fields. It’s an easy way to add new fields to the order form in WooCommerce. Flexible Checkout Fields is a very-well-rated plugin with over 90,000 stores using it daily.💡Also, check out our invoicing plugin for WooCommerce with the built-in EU VAT number validation.
Add the EU VAT number field to the Checkout
👉🏼 First, we have to add a field to validate it. After you install and activate the Flexible Checkout Fields plugin, go to WooCommerce → Checkout Fields, and in the Add New Field section choose Text. Next, enter the field label and click on the Add Field button.
👀 Watch the short video tutorial from the user showcase:
Add EU VAT number validation in WooCommerce
When you have your EU VAT field, it's time to add proper validation. That means that WooCommerce will check if the customer's EU VAT number is valid based on EU regulations. In this case, I have to make my validation, because Flexible Checkout Fields has only email, phone number, and postal code validation built into its core.
Add custom code to functions.php
To add new validation to WooCommerce you have to add the code that is displayed below to your functions.php file. Please remember to add the code again if you change or update your WordPress theme!💡This article might help you if you are not sure how to do it: Validate WooCommerce Checkout Fields
Add EU VAT number validation
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 General tab you can choose whether the field should be required or not.
Now go to the Advanced tab. In the Validation section, you should see your new custom validation.
Choose your validation and click on Save Changes. Let’s try it out.
EU VAT number validation in the WooCommerce checkout form - Final effect
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.
Summary & 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 also use the Flexible Invoices plugin, which has the built-in EU VAT number validation in the European VIES database directly & live at the checkout!
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.