How to remove all fields from WooCommerce checkout except email

If you’re building a WooCommerce store there’s a chance you won’t need all the fields in the default checkout form.

You can remove some fields using free plugins, or buy premium plugin to customize WooCommerce checkout but if you’re like me, you probably don’t want to add yet another plugin just to remove a field or two.

Lately I had a client who needed to remove almost all the fields from WooCommerce Checkout page. Just leave email, payment selector, and nothing more. Here’s how I did it without any plugins.

How to remove any field from WooCommerce checkout page without plugins

WooCommerce has quite a few fields in Checkout page by default. To remove them we’ll create a custom function in theme’s functions.php file. Depending on the theme you use go to Appearance >> Theme File Editor or Tools >> Theme File Editor, and click functions.php file on the right.

Add this function at the bottom of the page, and call it like that:

function tomasgdev_remove_fields($fields=array()) {

}
add_filter('woocommerce_billing_fields','tomasgdev_remove_fields');

Now you have an empty function that will be used to remove any field you don’t need in the Checkout page. Let’s remove some fields!

Here’s all the list of fields you can remove from WooCommerce Checkout page:

  • unset($fields[‘billing_first_name’]); – remove first name field
  • unset($fields[‘billing_last_name’]); – remove last name field
  • unset($fields[‘billing_company’]); remove company name field
  • unset($fields[‘billing_address_1’]); – remove address 1 field
  • unset($fields[‘billing_address_2’]); – remove address 2 field
  • unset($fields[‘billing_city’]); – remove city field
  • unset($fields[‘billing_postcode’]); – remove postcode field
  • unset($fields[‘billing_state’]); – remove state field
  • unset($fields[‘billing_country’]); remove country field
  • unset($fields[‘billing_phone’]); – remove phone field

If you want to remove all these fields from the Checkout page you just need to add them to the function we wrote before. So it would look like this:

function tomasgdev_remove_fields($fields=array()) {
 unset($fields['billing_first_name']);
 unset($fields['billing_last_name']);
 unset($fields['billing_company']);
 unset($fields['billing_address_1']);
 unset($fields['billing_address_2']);
 unset($fields['billing_city']);
 unset($fields['billing_postcode']);
 unset($fields['billing_state']); 
 unset($fields['billing_country']);
 unset($fields['billing_phone']);
}
add_filter('woocommerce_billing_fields','tomasgdev_remove_fields');

After saving changes all the fields in the Checkout page will be removed except Notes.

To remove order notes add this filter to the end of the same functions.php file:

add_filter('woocommerce_enable_order_notes_field', '__return_false',9999);

That’s it – now you’have only email address in the WooCommerce Checkout field list.

Hostinger Black Friday deals