Posted on

WooCommerce: Disable PostCode/Zip Field on the Checkout Page

In some countries there is no Postcode/ZIP (such as Ireland!). How do we make the Postcode/ZIP field not required, or how do we completely remove it? The answer is very simple.

Remove the Postcode Field on the WooCommerce Checkout Page
Remove the Postcode Field on the WooCommerce Checkout Page

PHP Snippet: Remove Postcode/ZIP Field @ WooCommerce Checkout


/**
* @snippet Remove the Postcode Field on the WooCommerce Checkout
* @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
* @sourcecode https://businessbloomer.com/?p=461
* @author Rodolfo Melogli
* @testedwith WooCommerce 3.5.1
*/

add_filter( 'woocommerce_checkout_fields' , 'bbloomer_remove_billing_postcode_checkout' );

function bbloomer_remove_billing_postcode_checkout( $fields ) {
  unset($fields['billing']['billing_postcode']);
  return $fields;
}

Official Documentation

https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert, WordCamp speaker and Internet marketer, Rodolfo Melogli has worked as a WooCommerce freelancer since 2011. He helps entrepreneurs and developers overcome their WooCommerce nightmares :) Rodolfo is the organiser of WordCamp Dublin, the Dublin WooCommerce Meetup, the Dublin Ecommerce Meetup and the Dublin WordPress Meetup. He enjoys interacting with people, travelling and chasing tennis & soccer balls. Of course, he loves pizza too.

32 thoughts on “WooCommerce: Disable PostCode/Zip Field on the Checkout Page

  1. Using this snippet, you can remove multiple checkout fields. Just be sure to modify the field name, both filter and function. For example, if you don’t ship to more than one country, you could remove the country field by replacing “postcode” with “country”.
    If you need to remove multiple fields or customize them more, use a plugin.

    1. Thank you Cristian ๐Ÿ™‚

  2. Hi Today i have customize one of zip-code checker plugin using help of your all hooks code…i am Really thanks full to you.

    1. Cool, thank you Mounish!

  3. It worked.. Thanks..
    What I need to add to this code so PostalCode dissapear from Editiing Billing & Shipping Addresses?
    Thanks

    1. Gabriel, thanks for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here on the blog. Thanks a lot for your understanding! ~R

  4. thanks it worked for me

    1. Excellent! Thanks Adnan ๐Ÿ™‚

  5. hello, I copy and paste the code to function.php but it doesnt work.

    1. Hey Burak, it should work ๐Ÿ™‚ Just to make sure, the correct file is functions.php (with an “S” at the end). Let me know!

  6. […] already seen how to disable fields on the checkout page by using a […]

  7. Where can i paste the text? I can’t seem to find the place to paste it.

    Kind regards,

    Hannah

    1. Hello Hannah, thanks for your comment! You can place this snippet in your child theme’s functions.php file – if you need more guidance, please take a look at this video tutorial: http://businessbloomer.com/woocommerce-customization-hangout/

  8. […] already saw how to completely remove the PostCode/ZIP field… but this time we wish to leave it on the checkout, and just avoid a validation error if we […]

  9. Thank you Rodolfo, It was driving me crazy ๐Ÿ™‚

    1. No problem Jose! Thanks for your feedback ๐Ÿ™‚

  10. Hi there, thanks for the plugin, however when I have tried to make the postcode field not mandatory and also removing it completely, Woo COmmerce checkout STILL shows “Please enter a valid postcode/ZIP” Even when the field isn’t visible during checkout… Any help is greatly appreciated. Rick

    1. Hey Rick, thanks for your comment ๐Ÿ™‚ This is strange, I use this trick on all my sites and get no validation warning. Are you running all the latest versions of WooCommerce / plugins / Theme / WP?

  11. It really works but it change the other field in my checkout form ๐Ÿ™

    1. Hey Adi thanks for your feedback ๐Ÿ™‚ What “other field” are you referring to?

  12. Excelent job, it works, thank you very much!

    1. Cheers Marius! ๐Ÿ™‚

  13. Hi Rodolfo, this sounds great, but will I have the option to remove the requirement for a postcode on the Shopping Cart page, where I calculate shipping?

    1. Noelle, thanks for your feedback! Unfortunately you can’t do what you’re asking, see this post from Woocommerce developer. However, you could disable the shipping calculator all together from the Woo settings ๐Ÿ™‚

    2. Thanks for your reply, Rodolfo ๐Ÿ˜‰

    3. You’re welcome ๐Ÿ™‚

    4. Hi again Rodolfo, I just installed the free plugin and it works great, thank you! I just thought i’d send you the suggestion to have the minimal fields within the billing and shipping address settings as defaulting to ‘required’. For example, I nearly lost a sale because my billing and shipping sections don’t have ‘State/County’ as fields and yet the default setting is to have this field as ‘required’. It doesn’t seem to have affected customers from Ireland but a customer from the Netherlands was not able to complete her purchase because she could not move past this point. I suppose I should have checked all of the settings, but I didn’t. Just a suggestion for others who are lazy about checking these things like me! Thanks again!

    5. Thanks so much for your feedback Noelle!

  14. Thank your tips. It’s work for me

  15. Hi, I am trying to eliminate en billing checkout the zip code but is not working.
    your plugin working with woocommerce 2.3.7??

    1. Hello Efrain ๐Ÿ™‚ Thanks for your feedback. The plugin definitely works, I use it on all my websites – could you possibly send a screenshot of your Checkout Billing plugin settings (as per my article) so that I can take a look?

Questions? Feedback? Support? Leave your Comment Now!
If you're writing code, please wrap it between: [php] code_here [/php]

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.