Adding custom checkout fields in WooCommerce block checkout: company number, VAT ID and more

In the WooCommerce block checkout, the old checkout field filters don't work; extra fields are registered through the Additional Checkout Fields API. How to add a company number, VAT ID or a "buying for a business" option, where values are stored, how to validate them and the API's limits.

5 min read

In this article
  1. Classic vs block checkout: how custom fields differ
  2. The three locations
  3. Code example: "buying for a business" plus a UK company number
  4. Where values are stored — and how to read them
  5. The API's limits (documentation as of October 2026)
  6. Plugin, code or classic checkout?
  7. What drives the cost
  8. What to do tomorrow
  9. FAQ

If your WooCommerce store uses the block-based checkout — the default for new stores since WooCommerce 8.3 (November 2023) — the classic ways of adding fields, the woocommerce_checkout_fields filter and many "checkout field editor" plugins, no longer apply. Custom fields are registered through the Additional Checkout Fields API, stable since WooCommerce 8.9 (2024): you call woocommerce_register_additional_checkout_field(), choose one of three locations (contact, address or order) and one of four field types (text, select, checkbox, date). For B2B sales the usual trio is a "buying for a business" checkbox, a company registration number and a VAT ID, so invoices are issued correctly.

This guide is for stores whose extra fields vanished after a checkout rebuild, and for anyone adding fields to the block checkout for the first time.

Classic vs block checkout: how custom fields differ

Classic ([woocommerce_checkout] shortcode) Block checkout
How fields are added PHP filters (woocommerce_checkout_fields), many plugins Additional Checkout Fields API, or block-compatible plugins
Default before WooCommerce 8.3 for new stores from 8.3
Legacy field plugins work often don't, or only partly
Conditional logic custom code JSON Schema rules (show / require based on another field)

Many older stores still run the classic checkout, where legacy fields keep working. Trouble starts when the page is rebuilt with blocks.

The three locations

  • contact — at the top next to the email; the value is also saved to the customer's account, which suits repeat trade buyers.
  • address — inside the address forms; the field appears in both billing and shipping, collecting two values.
  • order — a separate section near the end; the value is stored on the order only.

For a company number or VAT ID, contact (re-used on the next order) or order (if buyers change) usually fits best.

Code example: "buying for a business" plus a UK company number

add_action( 'woocommerce_init', function () {
	woocommerce_register_additional_checkout_field( [
		'id'       => 'your-shop/buying-for-business',
		'label'    => 'I am buying for a business (VAT invoice needed)',
		'location' => 'contact',
		'type'     => 'checkbox',
	] );
	woocommerce_register_additional_checkout_field( [
		'id'       => 'your-shop/company-number',
		'label'    => 'Company registration number',
		'location' => 'contact',
		'type'     => 'text',
	] );
} );

add_action( 'woocommerce_validate_additional_field', function ( WP_Error $errors, $field_key, $field_value ) {
	if ( 'your-shop/company-number' === $field_key && '' !== $field_value && ! preg_match( '/^[A-Z0-9]{8}$/i', $field_value ) ) {
		$errors->add( 'company_number', 'UK company numbers have 8 characters, e.g. 01234567 or SC123456. Please check for spaces.' );
	}
}, 10, 3 );

Register fields on woocommerce_init or later, and give each field a namespaced id (your-shop/...). Conditional rules — "company number required only when the business box is ticked" — are expressed as JSON Schema, which WooCommerce evaluates in the browser and on the server.

For VAT IDs, validate the format first (GB plus nine digits for most UK numbers; EU formats vary by country), then check validity with HMRC's VAT checker or the EU's VIES service. Whether and how VAT applies is a tax question for your accountant; the store simply implements the rule.

Where values are stored — and how to read them

The API generates the meta keys itself, prefixed _wc_billing/, _wc_shipping/ or _wc_other/; you cannot choose them. WooCommerce recommends reading values through the CheckoutFields helpers (get_field_from_object()) rather than raw meta. In practice: check that your invoice plugin, order emails and integrations (accounting, CRM) actually pick up the new fields. The most common failure is a field that shows at checkout but never makes it onto the invoice.

The API's limits (documentation as of October 2026)

  • One location per registered field.
  • Address fields always appear in both billing and shipping.
  • Four field types only: text, select, checkbox and date.
  • No custom attributes on selects; autofocus and disabled are stripped.
  • For logged-in customers, values are saved to the account only after an order is placed.

If you need more — a file upload, a complex field group — the options are a block-compatible plugin, a custom block (React), or reverting that page to the classic checkout.

Plugin, code or classic checkout?

Route When it fits What to check
A field plugin a few simple fields, no developer that it explicitly supports the block checkout, not just classic
Code via the API two to five fields, validation, conditions, invoices fields reach invoices, emails and integrations
Revert to classic checkout legacy plugins you can't replace yet you give up block checkout features; treat it as temporary

For the broader buy-versus-build question see WordPress vs custom-coded website; for getting fields onto invoices, invoice automation for small businesses.

What drives the cost

The number of fields and their logic, validation (format checks, VIES or HMRC lookups), where the values must appear (invoices, emails, accounting, CRM), and the plugins and theme already in place. Tell us which fields you need and where they should show up, and we will reply within 24 hours with a scope, estimate and timeline: contact us. More on our WooCommerce work.

What to do tomorrow

Open your checkout page in the editor. If you see a Checkout block, your store uses the block checkout and legacy field plugins may not work. Place a test order as a business and confirm that the company details appear on the order, the email and the invoice.

FAQ

Why did my custom WooCommerce checkout fields disappear?

Usually because the checkout page was switched to the block checkout, and the fields had been added with the legacy filter or a plugin that doesn't support blocks.

How do I add a VAT number field to WooCommerce checkout?

In the block checkout, use the Additional Checkout Fields API (woocommerce_register_additional_checkout_field) or a block-compatible plugin; in the classic checkout, the woocommerce_checkout_fields filter or a plugin.

Can a field show only when "buying for a business" is ticked?

Yes. The API supports conditional visibility and required rules through JSON Schema based on other field values.

Will the new fields appear on invoices automatically?

Not always. Your invoice plugin has to read them — confirm with a test order and add the fields to the invoice template if needed.

Should I switch back to the classic checkout?

Only temporarily, when a critical plugin can't work otherwise. WooCommerce's direction is the block checkout, so plan to move fields to the API.

More posts

All posts