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 Get CustomizeWoo.com FREE
* @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 custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Cart and Checkout on the Same Page
    This is your ultimate guide – complete with shortcodes, snippets and workarounds – to completely skip the Cart page and have both cart table and checkout form on the same (Checkout) page. But first… why’d you want to do this? Well, if you sell high ticket products (i.e. on average, you sell no more than […]
  • WooCommerce: Disable Payment Method If Product Category @ Cart
    Today we take a look at the WooCommerce Checkout and specifically at how to disable a payment gateway (e.g. PayPal) if a specific product category is in the Cart. There are two tasks to code in this case: (1) based on all the products in the Cart, calculate the list of product categories in the […]
  • WooCommerce: Add Privacy Policy Checkbox @ Checkout
    Here’s a snippet regarding the checkout page. If you’ve been affected by GDPR, you will know you now need users to give you Privacy Policy consent. Or, you might need customer to acknowledge special shipping requirements for example. So, how do we display an additional tick box on the Checkout page (together with the existing […]
  • WooCommerce: Redirect to Custom Thank you Page
    How can you redirect customers to a beautifully looking, custom, thank you page? Thankfully you can add some PHP code to your functions.php or install a simple plugin and define a redirect to a custom WordPress page (as opposed to the default order-received endpoint). This is a great way for you to add specific up-sells, […]
  • WooCommerce: Disable Payment Gateway by Country
    You might want to disable PayPal for non-local customers or enable a specific gateway for only one country… Either way, this is a very common requirement for all of those who trade internationally. Here’s a simple snippet you can further customize to achieve your objective. Simply pick the payment gateway “slug” you want to disable/enable […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

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

  1. thank you

  2. Worked Perfectly fine Thanks

  3. Thank you very much, it’s working fine for me, so I can remove a plugin to do this function before …

    1. Spot on

  4. hi, this doesnt work, copied and pasted exactly, but no change. what could have gone wrong?

    1. No idea, sorry

  5. It worked perfectly, thank you!

    1. Awesome

  6. It really works. Thank you Rodolfo,

    1. You’re welcome!

  7. Hi there.

    And thanks for share these all codes.
    Question.
    If i need hide/unset field in checkout>billing/shipping adress.
    Based on a multiple countries?

    I have this peace of code, but how make this to multiple countries? And multiple fields?

    
    add_filter( 'woocommerce_checkout_fields', 'custom_override_checkout_fields' );
    
    function custom_override_checkout_fields($fields){
        global $woocommerce;
        $country = $woocommerce->customer->get_billing_country();
        	if($country !== 'AO'){
        		unset($fields['billing']['billing_postcode']);
        	}
        return $fields;
    }
    

    Thank you

    1. Hi Jsotnas, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

    2. Hi Rodolfo,

      How much?

      Thank you

      1. Hi there, please contact me in private. Thank you!

  8. Hey. Is it possible to have a validation for post code so that the customer does not enter 0000?
    Thanks.

    1. Hello Nalia, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  9. 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 🙂

  10. 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!

  11. 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

  12. thanks it worked for me

    1. Excellent! Thanks Adnan 🙂

  13. 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!

  14. 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: https://businessbloomer.com/woocommerce-customization-hangout/

  15. Thank you Rodolfo, It was driving me crazy 🙂

    1. No problem Jose! Thanks for your feedback 🙂

  16. 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?

  17. 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?

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

  19. 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 🙂

      1. Thanks for your reply, Rodolfo 😉

        1. You’re welcome 🙂

          1. 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!

            1. Thanks so much for your feedback Noelle!

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

  21. 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? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

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