How to Add, Remove and Edit WooCommerce Checkout Fields

Written by

in

Contents

0
(0)

To add, remove or edit WooCommerce checkout fields: on the Block checkout, use the Address Fields panel to show, hide or require company, address line 2 and phone, and register extra fields with woocommerce_register_additional_checkout_field(). On the Classic checkout, filter woocommerce_checkout_fields. Both methods are below, tested on WooCommerce 11.3.

Every step and snippet here was run on WordPress 7.1.5 with WooCommerce 11.3.1 (Twenty Twenty-Five theme) in December 2026, and the screenshots come from that test store. If you are still choosing a plugin instead, see our checkout field editor plugin review; this guide is the no-plugin route.

First: do you have the Block or the Classic checkout?

The two checkouts store their fields differently, so the right method depends on which one your store uses. Open Pages → Checkout and edit the page:

  • Block checkout: the page is made of WooCommerce blocks (Checkout → Checkout Fields → Contact Information, Shipping Address …). New stores use this one by default.
  • Classic checkout: the page contains a single Shortcode block with [woocommerce_checkout].

Code written for one checkout is mostly ignored by the other. That is the number one reason a pasted snippet “does nothing” (see the FAQ). Where to put the snippets: a small custom plugin or a code-snippets plugin. Avoid your theme’s functions.php, because a theme update or switch will wipe it.

Part 1: Block checkout

Step 1: Show, hide or require company, address line 2 and phone

WooCommerce has a built-in switch for the three address fields stores change most. No code needed:

  1. Go to Pages → Checkout and click Edit.
  2. Select the Checkout Fields block (open the List View and click it, or click an empty area of the form column).
  3. In the block sidebar open the Address Fields panel.
  4. Switch Company, Address line 2 and Phone on or off. When a field is on, choose Optional or Required.
  5. Click Update.

This is what the default store looks like: company is hidden, address line 2 is tucked behind the “+ Add apartment, suite, etc.” link, and phone is optional.

WooCommerce Block checkout shipping address with the default fields: no company field, an add apartment link and an optional phone field
Block checkout with WooCommerce’s defaults

After switching Company on and setting it to Required, switching Address line 2 off and setting Phone to Required, the form looks like this: a Company field appears, the apartment link is gone and “(optional)” disappears from Phone.

WooCommerce Block checkout shipping address after the Address Fields settings: company and phone required, address line 2 removed
Same form after the Address Fields settings: company and phone required, address line 2 hidden

Good to know: the panel saves three site options, woocommerce_checkout_company_field, woocommerce_checkout_address_2_field and woocommerce_checkout_phone_field, each set to hidden, optional or required. The Classic checkout reads the same options (we checked: with phone and company set to required and address line 2 hidden, the Classic form followed). You can also set them from the command line, for example wp option update woocommerce_checkout_phone_field required.

Step 2: Add a custom field to the Block checkout

Since WooCommerce 8.9 the Block checkout has an official Additional Checkout Fields API. You register a field in PHP and WooCommerce renders it, validates it, saves it with the order and shows it on the order confirmation. The old woocommerce_checkout_fields filter does not work here.

Add this to your plugin. Register on the woocommerce_init hook:

add_action( 'woocommerce_init', function () {

	// A text field inside the address form (shows for billing and shipping).
	woocommerce_register_additional_checkout_field( array(
		'id'       => 'bc/vat-number',
		'label'    => 'VAT number',
		'location' => 'address',
		'type'     => 'text',
		'required' => false,
	) );

	// A select in the "Additional order information" section.
	woocommerce_register_additional_checkout_field( array(
		'id'       => 'bc/heard-from',
		'label'    => 'How did you hear about us?',
		'location' => 'order',
		'type'     => 'select',
		'required' => false,
		'options'  => array(
			array( 'value' => 'search', 'label' => 'Search engine' ),
			array( 'value' => 'friend', 'label' => 'A friend' ),
			array( 'value' => 'other',  'label' => 'Other' ),
		),
	) );
} );

The pieces you will change most:

  • id: must be unique and written namespace/name (use your own prefix, like bc/ here).
  • location: contact (next to the email), address (inside the billing and shipping address forms) or order (the “Additional order information” section).
  • type: text, select, checkbox or date (the types WooCommerce 11.3.1 accepts; any other type is rejected).
  • required: set to true to make it mandatory. We tested it: placing an order without a required field is rejected by the checkout, and the same order with the field filled in goes through.

The text field shows up in the address form, with “(optional)” added to the label automatically:

WooCommerce Block checkout address form with a custom VAT number (optional) field added by code
The “VAT number” field registered with location “address”

And the select appears under Additional order information:

WooCommerce Block checkout additional order information section with a How did you hear about us select field
The “How did you hear about us?” select registered with location “order”

Step 3: See and read the saved value

We placed a test order through the Block checkout. The values are shown on the order confirmation page without any extra code:

WooCommerce order confirmation page showing the custom VAT number under the billing and shipping address and the How did you hear about us answer under Additional information
Final result: both custom fields on the order confirmation page

In code, the values are stored as order meta. An address field is saved once for billing and once for shipping; an order field is saved once:

$order->get_meta( '_wc_billing/bc/vat-number' );   // DE123456789
$order->get_meta( '_wc_shipping/bc/vat-number' );  // DE123456789
$order->get_meta( '_wc_other/bc/heard-from' );     // search

What the Block checkout does not let you do with code (yet)

Core WooCommerce gives you the three address switches from step 1 and the API for new fields. It has no supported way to rename or reorder the fields it ships with. We tried the usual woocommerce_default_address_fields filter (make last name optional, relabel “Address” and “ZIP Code”) and the Block checkout ignored it: last name stayed required and the labels did not change. If you need that on the Block checkout, you have two options:

  • Switch the page to the Classic checkout (next part): edit the Checkout page, remove the Checkout block and add a Shortcode block with [woocommerce_checkout]. Everything in part 2 then applies.
  • Use a field editor plugin that supports the Block checkout. See when a plugin makes sense.

Part 2: Classic checkout

The Classic checkout (the [woocommerce_checkout] shortcode) builds its form from one array that WooCommerce passes through the woocommerce_checkout_fields filter. The array has four groups: billing, shipping, account and order. Add, remove or change entries in it and the form follows.

Step 4: Remove, edit and add fields in one filter

Put this in your plugin. It does all three jobs, marked 1 to 3:

add_filter( 'woocommerce_checkout_fields', function ( $fields ) {

	// 1. Remove fields (from billing and shipping).
	foreach ( array( 'billing', 'shipping' ) as $section ) {
		unset( $fields[ $section ][ $section . '_company' ] );
		unset( $fields[ $section ][ $section . '_address_2' ] );
	}

	// 2. Edit fields: make the phone required, change a label, change a placeholder, move a field.
	$fields['billing']['billing_phone']['required']   = true;
	$fields['billing']['billing_first_name']['label'] = 'Your first name';
	$fields['order']['order_comments']['placeholder'] = 'Gate code, delivery window, gift message…';
	$fields['billing']['billing_email']['priority']   = 5; // Lower number = higher up the form.

	// 3. Add a field.
	$fields['billing']['billing_vat'] = array(
		'type'        => 'text',
		'label'       => 'VAT number',
		'placeholder' => 'e.g. DE123456789',
		'required'    => false,
		'class'       => array( 'form-row-wide' ),
		'priority'    => 35,
	);

	return $fields;
} );

How each part works:

  • Remove: unset() the field. The key is the field name, such as billing_company, billing_address_2 or shipping_phone. Remove it from shipping too, or it stays on the shipping form. Do not remove fields that your payment gateway or tax setup needs (country, state, postcode).
  • Edit: every field is an array. Change label, placeholder, required, class (the CSS classes that control width, for example form-row-first and form-row-last for two columns) or priority (the sort order: lower is higher on the page).
  • Add: add a new key. The type can be text, textarea, select, checkbox, radio, email, tel and so on. Name the key with a billing_ or shipping_ prefix and WooCommerce saves it with the order for you (step 5).

Result on the Classic checkout: email moved to the top, “Your first name” label, a new optional VAT number field after the name, no company or address line 2, and a required phone with a red asterisk.

WooCommerce Classic checkout billing form after the filter: email first, renamed first name, a new VAT number field, no company or address line 2 fields
Final result: Classic checkout billing form after the filter (Twenty Twenty-Five theme)

Step 5: Check that the value is saved and show it

We placed a test order through WooCommerce’s own checkout code with the snippet active. The new field was saved as the order meta _billing_vat, the order note field kept its text, and the removed fields were not part of the submitted data. No save code is needed for fields prefixed billing_ or shipping_. To show the value on the admin order screen, under the billing address:

add_action( 'woocommerce_admin_order_data_after_billing_address', function ( $order ) {
	$vat = $order->get_meta( '_billing_vat' );
	if ( $vat ) {
		echo '<p><strong>VAT number:</strong> ' . esc_html( $vat ) . '</p>';
	}
} );

We confirmed that this hook outputs VAT number: DE123456789 for the test order. Always escape saved values with esc_html() when you print them.

When a plugin makes more sense than code

Code is the right tool when you need a handful of changes and want zero extra plugins. A plugin is easier when someone non-technical manages the fields, when you want to reorder fields by drag and drop, or when you want to relabel core fields on the Block checkout (which core cannot do, see above).

Per its WordPress.org listing, the free Checkout Field Editor (Checkout Manager) for WooCommerce by ThemeHigh states “Compatible with Classic & Block Checkout” and supports up to 20 field types on the Classic checkout and 10 on the Block checkout in the free version. We did not test it for this guide. Our plugin review compares the options.

FAQ

Why doesn’t my woocommerce_checkout_fields code work?

Most likely your Checkout page uses the Block checkout, which does not read that filter. Check the page in the editor (see the first section). On the Block checkout use the Address Fields panel and woocommerce_register_additional_checkout_field(); or switch the page to the [woocommerce_checkout] shortcode. The other common cause is a snippet pasted into a theme’s functions.php that is no longer the active theme.

How do I remove the phone field from WooCommerce checkout?

On the Block checkout, switch Phone off in the Address Fields panel (or run wp option update woocommerce_checkout_phone_field hidden). On the Classic checkout, unset( $fields['billing']['billing_phone'] ) in the filter from step 4, or use the same option.

How do I make a checkout field required or optional?

Company, address line 2 and phone: the Address Fields panel (Block) or the same options (Classic). Your own fields: 'required' => true in the field definition, in both the Block API and the Classic filter.

How do I add a custom field to the Block checkout without a plugin?

Register it with woocommerce_register_additional_checkout_field() on woocommerce_init, as in step 2. It needs WooCommerce 8.9 or newer. The core API supports text, select, checkbox and date fields.

Where is the custom checkout field data saved?

As order meta. Classic fields named billing_xxx or shipping_xxx are saved as _billing_xxx or _shipping_xxx. Block fields are saved as _wc_billing/your/id, _wc_shipping/your/id (address fields) or _wc_other/your/id (contact and order fields).

Can I remove the coupon field or a shipping option from checkout too?

Those are not form fields. See how to hide the coupon prompt on the checkout page and how to disable a shipping method.

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *