How to add a VAT number field to WooCommerce B2B registration
By Raz Technologies · published · data updated
How do I add a VAT number field to B2B customer registration in WooCommerce?
Use a B2B registration plugin that adds a VAT number field (6 of the 15 we track document one, 5 also document validating it, 3 explicitly against the EU VIES service) or add the field with three WooCommerce hooks (below) if a format check is enough. As of 2 November 2026, the top-ranked plugin in our B2B registration ranking is EU/UK VAT Validation Manager for WooCommerce (79.0/100). See our B2B registration plugin ranking for the full comparison.
The problem
B2B stores in the EU need a customer's VAT number to sell without VAT under the reverse charge, and often want to check it before approving the account. WooCommerce's registration form has only an email and a password.
Option 1: a plugin (no code)
These ranked B2B registration plugins document a VAT number field (evidence: Documented, from each plugin's readme or listing). Open a profile to see whether the plugin only stores the number or validates it, and the vendor's exact wording.
| Plugin | Rank | Feature in | Checkout Blocks | Installs |
|---|---|---|---|---|
| EU/UK VAT Validation Manager | #1 | Free version | Not declared | 7,000+ |
| Kybernaut IČO DIČ | #2 | Free version | No | 2,000+ |
| B2BKing | #3 | Paid version | Not declared | 10,000+ |
| WooCommerce B2B | #4 | Paid version | Not declared | No data |
| EU VAT Guard | #8 | Free version | Not declared | 300+ |
| WooCommerce Eu Vat & B2B | #10 | Paid version | Not declared | No data |
Need other fields too (company name, tax certificate upload) or approval before first order? 8 plugins we track document extra registration fields (3 in the free version):
| Plugin | Rank | Feature in | Checkout Blocks | Installs |
|---|---|---|---|---|
| B2BKing | #3 | Paid version | Not declared | 10,000+ |
| WooCommerce B2B | #4 | Paid version | Not declared | No data |
| Whols | #5 | Free version | Not declared | 3,000+ |
| Registration Fields Plugin | #6 | Paid version | Not declared | No data |
| EU VAT Guard | #8 | Free version | Not declared | 300+ |
| WooCommerce User Registration Plugin: Custom Fields, validate login & customer roles | #11 | Paid version | Not declared | No data |
| Custom Fields Account Registration | #14 | Free version | Not declared | 700+ |
| User Registration | #15 | Paid version | Not declared | No data |
Option 2: three hooks (for developers)
This adds an optional VAT number field to the My Account registration form, checks its format (two-letter country prefix plus 2–13 characters) and saves it on the customer. It does not check the number with VIES.
// 1. Show the field
add_action( 'woocommerce_register_form', function () { ?>
<p class="form-row form-row-wide">
<label for="reg_vat_number"><?php esc_html_e( 'VAT number', 'my-store' ); ?></label>
<input type="text" class="input-text" name="vat_number" id="reg_vat_number"
value="<?php echo esc_attr( wp_unslash( $_POST['vat_number'] ?? '' ) ); ?>" />
</p>
<?php } );
// 2. Check the format
add_filter( 'woocommerce_registration_errors', function ( $errors ) {
$vat = strtoupper( preg_replace( '/[^A-Za-z0-9]/', '', wp_unslash( $_POST['vat_number'] ?? '' ) ) );
if ( '' !== $vat && ! preg_match( '/^[A-Z]{2}[A-Z0-9]{2,13}$/', $vat ) ) {
$errors->add( 'vat_number', __( 'Enter the VAT number with its country prefix, e.g. DE123456789.', 'my-store' ) );
}
return $errors;
} );
// 3. Save it on the new customer
add_action( 'woocommerce_created_customer', function ( $customer_id ) {
$vat = strtoupper( preg_replace( '/[^A-Za-z0-9]/', '', wp_unslash( $_POST['vat_number'] ?? '' ) ) );
if ( '' !== $vat ) {
update_user_meta( $customer_id, 'vat_number', sanitize_text_field( $vat ) );
}
} );Make sure "Allow customers to create an account on the My account page" is on (WooCommerce → Settings → Accounts & Privacy), then register a test account.
What to check before you choose
- VIES validation, and what happens when the VIES service is down.
- Whether a valid VAT number removes VAT at checkout (reverse charge) or is only stored.
- A separate B2B form, so retail customers keep the short form.
Other plugins people ask about
- Wholesale Suite is not part of our B2B registration ranking; we rank it #2 of 15 in wholesale pricing, #1 of 5 in all-in-one B2B (as of 2 November 2026).
FAQ
Can WooCommerce check that a VAT number is valid?
Not by itself. Checking a number against the EU's VIES service needs a plugin or custom code: 3 of the 15 B2B registration plugins we track document VIES validation, 3 of them in the free version (as of 8 November 2026). The code above only checks the format.
Can I approve B2B accounts by hand before they can order?
Yes, with a plugin: 10 of the 15 B2B registration plugins we track document admin approval of new accounts, 3 of them in the free version (as of 8 November 2026).
Where is the VAT number stored?
With the snippet above, as user meta (vat_number) on the customer. Plugins usually also show it in the admin user screen and copy it to orders; check that if your invoices need it.
