WooCommerce Checkout Fields Remover
Generate the woocommerce_checkout_fields snippet that removes, relabels or makes optional the checkout fields your store does not need.
<?php
/**
* Checkout field changes.
*/
/**
* Removes, relabels and relaxes checkout fields.
*
* @param array $fields Checkout fields, grouped by section.
* @return array
*/
function my_store_checkout_fields( $fields ) {
unset( $fields['billing']['billing_company'] );
unset( $fields['billing']['billing_address_2'] );
if ( isset( $fields['order']['order_comments'] ) ) {
$fields['order']['order_comments']['label'] = __( 'Delivery instructions', 'my-store' );
$fields['order']['order_comments']['placeholder'] = __( 'Gate code, safe place, anything the driver should know.', 'my-store' );
}
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'my_store_checkout_fields' );
/**
* Applies the same changes to the saved address forms.
*
* The checkout filter does not touch My Account, Addresses, or the address
* fields in the admin order editor. This one does.
*
* @param array $fields Address fields.
* @return array
*/
function my_store_address_fields( $fields ) {
unset( $fields['company'] );
unset( $fields['address_2'] );
return $fields;
}
add_filter( 'woocommerce_default_address_fields', 'my_store_address_fields' );
Output is valid and updates as you type.
Fix the highlighted fields to update the output.
Tick the checkout fields your store does not need and the generator writes the woocommerce_checkout_fields snippet, including the second filter that stops the fields reappearing in My Account.
How to use
- Prefer making a field optional over removing it. An optional field still collects the value when a customer wants to give it, and nothing downstream breaks.
- Check your payment gateway before removing the phone number. Several require it, and the failure shows up as a declined payment, not a validation message.
- Leave the address book option on.
woocommerce_checkout_fieldsonly changes checkout; saved addresses and the admin order editor use a different filter. - Relabel the order notes field rather than deleting it if the problem is the wording. “Order notes” means nothing to most shoppers.
- Put the snippet in a site specific plugin, not in the theme. Checkout should survive a theme change.
Example
Company and second address line gone, phone made optional, order notes relabelled:
function acme_checkout_fields( $fields ) {
unset( $fields['billing']['billing_company'] );
unset( $fields['billing']['billing_address_2'] );
$fields['billing']['billing_phone']['required'] = false;
if ( isset( $fields['order']['order_comments'] ) ) {
$fields['order']['order_comments']['label'] = __( 'Delivery instructions', 'acme' );
}
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'acme_checkout_fields' );
The second filter, woocommerce_default_address_fields, is what keeps those fields out of My Account and the admin order screen.
Pitfalls
- Removing a field does not remove the data already stored against past orders. It stops new orders collecting it.
woocommerce_checkout_fieldsonly affects the checkout form. Saved addresses, the admin order editor and the shortcode address form usewoocommerce_default_address_fields.- Some gateways require a phone number or a full address. Removing the field gives you a gateway error at payment, long after the customer filled the form in.
- Unsetting a field that a plugin added later runs before that plugin. Use a later filter priority when a field refuses to disappear.
- The blocks based checkout does not use these filters. If your store uses the Checkout block, field changes go through its own settings or a block filter.
- Making a field optional keeps validation off but leaves the field in the address format, so it still prints on the invoice when filled.
- Country specific locales override these settings. A field can be required again for one country through
woocommerce_get_country_locale. - Removing
order_commentsalso removes the customer’s only free text route, which usually ends up as an email to support instead.
Compatibility
woocommerce_checkout_fields and woocommerce_default_address_fields have been stable since WooCommerce 2.x and still apply to the classic shortcode checkout in WooCommerce 8 and 9. The Checkout block, default since WooCommerce 8.3, ignores both. The generated code targets PHP 7.0 and up, and the tool runs entirely in your browser.
Frequently asked questions
Why is the field still there?
Does removing a field delete old data?
Can I remove the state or postcode field?
How do I make a field required instead?
['required'] = true on it in the same filter. The generated snippet shows the pattern.Where should this code live?
functions.php it disappears the day the theme changes.