Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Remove checkout fields you don’t need

Removes company name and the second address line from the checkout. Edit the list to remove other fields.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Needs WooCommerce
  • Tested with WordPress 7.1, WooCommerce 11.1
PHP
<?php

// Field names: billing_company, billing_address_2, billing_state,
// billing_phone, shipping_company, shipping_address_2, shipping_state...
$remove = array( 'billing_company', 'billing_address_2', 'shipping_company', 'shipping_address_2' );

add_filter(
	'woocommerce_checkout_fields',
	static function ( $fields ) use ( $remove ) {
		foreach ( $remove as $name ) {
			$group = strtok( $name, '_' );
			unset( $fields[ $group ][ $name ] );
		}
		return $fields;
	},
	20
);

Good to know

Applies to the classic checkout. With the block checkout, turn fields off in the Checkout block’s settings instead.

In these packs

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.