When you are selling digital or virtual products with your WooCommerce store, you probably don’t need all the checkout fields.
I was getting many requests for this particular “issue”, so here is how you can safely remove default WooCommerce checkout fields.
There are two approaches*:
- By installing a plugin My Custom Functions and add the following code inside Appearance -> Custom Functions
- By adding this snippet to your themes functions.php file
Note that editing your theme functions.php file can be risky on your live site. So unless you know what you’re doing, or at least have an access to cPanel or FTP, I suggest to go with #1.
The snippet for removing default WooCommerce checkout fields is below:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_first_name']); unset($fields['billing']['billing_last_name']); unset($fields['billing']['billing_company']); unset($fields['billing']['billing_address_1']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_state']); unset($fields['billing']['billing_phone']); unset($fields['order']['order_comments']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_company']); unset($fields['billing']['billing_last_name']); unset($fields['billing']['billing_email']); unset($fields['billing']['billing_city']); return $fields; }
So if you want to remove only billing phone, your snippet would look like
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_phone']); return $fields; }
That’s all! A few lines of code and you can remove WooCommerce checkout fields in a few minutes! If you made a typo and you can’t get back in to WordPress, use FTP to edit your functions.php file and fix or remove the code.
If you are looking for more customization, we also created a post on how you can reorder your billing fields.
*Updated 2019: WooCommerce now has a plugin called Checkout Field Editor to remove fields without needing to touch a line of code! The plugin also allows you to add new or edit the billing fields from the plugin dashboard.
Hameed
February 6, 2019 | 7:55 am
Thank you,
How do I remove “SHIP TO A DIFFERENT ADDRESS?” checkbox from the checkout page?
WPBrainery
February 6, 2019 | 4:40 pm
Hey Hameed, great question. Woocommerce put this in their options at WooCommerce → Settings → Shipping → Shipping options
Under Shipping Destination, you’ll want to select: “Force shipping to the customer billing address”
You can read more about it in their documentation: https://docs.woocommerce.com/document/configuring-woocommerce-settings/#section-13