WooCommerce PHP Beginner Requires WooCommerce

Remove Fields From the Classic Checkout

Remove the company name, second address line and other fields you don't need from the classic checkout form.

Tested on WordPress 7.1 PHP 8.3 Updated
functions.php 10 lines
add_filter( 'woocommerce_checkout_fields', function ( array $fields ): array {
	unset(
		$fields['billing']['billing_company'],
		$fields['billing']['billing_address_2'],
		$fields['shipping']['shipping_company'],
		$fields['shipping']['shipping_address_2'],
		$fields['order']['order_comments'] // "Order notes".
	);
	return $fields;
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

Every extra field on checkout is one more reason to give up. If you never need a company name or a second address line, removing them makes checkout shorter.

How it works

The woocommerce_checkout_fields filter receives every checkout field grouped into billing, shipping, account and order. Removing a key removes that field from the form and from validation.

Field keys follow the pattern billing_first_name, billing_phone, shipping_postcode and so on. Remove only what you’re sure you don’t need.

Things to watch

  • Don’t remove fields your payment gateway or shipping plugin needs. Many gateways need the full billing address for fraud checks.
  • Digital-only stores can remove the whole shipping group, but WooCommerce already hides it when nothing in the cart needs shipping.
  • The block-based Checkout doesn’t use this filter. In the editor, select the Checkout block and switch fields like Company and Address line 2 to Hidden or Optional.

How to test it

Open checkout with an item in the cart. The removed fields should be gone, and an order should still go through.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only