Remove a field from the WooCommerce classic checkout

Published 4 min read

WooCommerce 11.3 added a shipping phone field to the classic checkout shortcode. It only surfaces when a customer ticks 'Ship to a different address', so it went unnoticed in most test passes. For stores that never use that number, it adds length to a form at the stage where most carts are abandoned.

The classic shortcode checkout exposes a PHP filter, woocommerce_checkout_fields, that controls its entire field set. It hands your code an array with four keys: billing, shipping, account, and order. Anything you unset from that array disappears from the rendered form before the page is sent.

shipping_phone: the new field, the conditional display, and where it lives

The field WooCommerce 11.3 added is shipping['shipping_phone']. It sits in the shipping sub-array alongside address, city, state, country, and postcode. It is marked required: false in its definition, which matters: unset it and WooCommerce drops it without leaving orphaned validation logic behind.

The conditional display is what hid it from many test setups. The field only renders when the customer has checked 'Ship to a different address.' A checkout screenshot taken against a single shipping address never shows it. If a site uses a checkout field plugin, the new field may also appear outside the plugin's field list, because the plugin was installed before the field existed.

Two checkout systems, one filter, and which one it reaches

WooCommerce ships two checkout implementations. The classic checkout, placed on a page via the [woocommerce_checkout] shortcode, assembles its field list in PHP before the page renders. The blocks checkout, introduced as the default in later WooCommerce versions, builds its form through a JavaScript-driven registration system. The woocommerce_checkout_fields filter runs for the shortcode implementation only.

To confirm which one is active: in WooCommerce > Settings > Advanced > Page Setup, the checkout page assignment shows which block or shortcode is in use. A plugin that hooks into woocommerce_checkout_fields will silently do nothing if the blocks checkout is in place. Getting this wrong is the most common reason a checkout field removal works in development and has no effect on the live site.

Required flags, server-side validation, and the fields that unset cleanly

The filter's four sub-arrays cover different parts of the form. billing holds name, company, address, city, state, postcode, country, phone, and email. shipping holds the same set without email, plus the new phone field. account controls the username and password fields shown when guest checkout with account creation is enabled. order holds only order_comments.

Required fields can be unset from the array without a PHP error, but WooCommerce's order submission handler validates against the original field definitions, not the filtered array. Remove billing_email from the UI and WooCommerce still checks for it at submission and returns a validation error. The same applies to billing_first_name, billing_last_name, and the other required billing fields. shipping_phone has required: false in its definition, so it unsets cleanly. Any field defined with required: false behaves the same way.

What you get

Included

  • Remove any field defined with required: false from billing, shipping, account, or order on the classic checkout shortcode
  • Admin screen listing every current checkout field grouped by billing, shipping, account, and order, with a hide checkbox per field
  • Hidden field list stored in wp_options, applied via woocommerce_checkout_fields on every checkout page load
  • Warning shown next to required fields in the admin screen to prevent accidental removal

Not included

  • WooCommerce Blocks checkout: that implementation uses a separate field registration system the woocommerce_checkout_fields filter does not reach
  • Reordering fields within a group: changing display order requires editing the priority value in each field's definition
  • Conditional removal based on cart contents, user role, or shipping zone
  • Removing required fields: billing_email, billing_first_name, and others marked required still trigger a validation error at order submission even when hidden from the form

WooCommerce Checkout Field Editor does the things on the right. This build covers the part most sites use.

Build it in Steem

The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.

Build this pluginAbout 55 credits. The free plan includes enough for one.
Read the prompt (146 words)

Build a WooCommerce plugin that lets the admin hide specific fields from the classic shortcode checkout using the woocommerce_checkout_fields filter. Add a settings page under WooCommerce > Checkout Fields. Read the checkout field array by running the woocommerce_checkout_fields filter with its default value, and display every field in a table grouped by its parent key: billing, shipping, account, and order. Show the field label and field key for each row, with a checkbox to hide it. Next to any field whose definition has required set to true, show a note that removing it will cause a validation error at order submission. When the checkout form loads, hook into woocommerce_checkout_fields and unset any fields the admin has marked hidden. Store the list of hidden field keys in wp_options. Do not hide required fields by default and do not unset them even if the admin checks the box.