Delete / Remove details from Checkout in WooCommerce (Postal Code, Company, Phone...)

WooCommerce is a very simple system for anyone who wants to create a shop, Based on WordPress.
Upon installation default, WooCommerce will add a standard form for billing details. In the customer's "Checkout" page.
Designed as a system shop which allows both the delivery of physical products and the download of virtual ones, WooCommerce ask in standard form a series of customer data: Name, Last Name, Telephone Number, Country, Address, City, Postal code. Some of these fields we need for a virtual command for example. A product that can be downloaded or product that was paid by PayPal would not need the data for delivery. In this case it is best to ease the control system for the user, by removing fields of Checkout.

Removal of the "Postal Code" field from WooCommerce Checkout

To be able to remove the "Postal Code" / Billing Postcode from WooCommerce, we need to go and edit the functions.php file of the theme WordPress which is active on the website. In functions.php we add the lines:

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_postcode']);
return $fields;
}

Where "billing_postcode" is the field for the postal code. If we want to remove the second address field, we will replace “billing_postcode” with “billing_address_2 ”.

 unset($fields['billing']['billing_address_2']);

There are situations that might not interest any details of customer's payment. Usually when payment is made through PayPal. In this scenario we can choose to eliminate all fields of the order page.

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
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;
}

In this way you will delete all the fields from WooCommerce checkout.

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » Internet » Delete / Remove details from Checkout in WooCommerce (Postal Code, Company, Phone...)

6 thoughts on "Delete / Remove details from Checkout in WooCommerce (Postal Code, Company, Phone...)"

  1. Bonjour Merci for the post!
    I needed to delete the company name and it's perfect it worked !!
    I also want to delete the company name on “ship to a different address”.
    but i don't know how to replace custom_override_checkout_fields in your code. Could you help me?

    Reply
  2. Hi, I added this code to functions.php as guided but my website crashed. It's totally blank. I’m not totally new to stuff like this but I’m not a pro either.

    If i could access my dashboard, i would just erase it but i can not access anything on my website at all.

    Please help, what should i do? Urgent response needed please!

    Reply
  3. Hello there
    Ben ödeme kısmında ki ”fatura bilgileri“ yazısını “teslimat adresi” olarak değiştirmek istiyorum. Not yapabiliriz.

    Reply
    • Hello,
      Yes, it is a good idea in the customizer but in the latest version of Woo I see only "address 2", "company". For postal code and oher fileds is req functions code to hide.

      Reply
Leave a Comment