WooCommerce: Disable Postcode/ZIP Validation @ Checkout

An annoying thing for sellers based in Ireland (for example), is that we still don’t use post codes (they recently introduced them, but nobody’s using them). So, in today’s task, I want to show you how to disable the “REQUIRED” feature of the postcode on the checkout page.

We 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 don’t enter anything.

Disable Postcode/ZIP Validation @ WooCommerce Checkout
Disable Postcode/ZIP Validation @ WooCommerce Checkout

PHP Snippet (Alternative #1): Disable Postcode/ZIP Validation @ WooCommerce Checkout

* @snippet       Disable Postcode/ZIP Validation @ WooCommerce Checkout
* @how-to        Get CustomizeWoo.com FREE
* @sourcecode    https://businessbloomer.com/?p=20203
* @author        Rodolfo Melogli
* @testedwith    WooCommerce 3.5.3
* @donate $9     https://businessbloomer.com/bloomer-armada/

add_filter( 'woocommerce_default_address_fields' , 'bbloomer_override_postcode_validation' );

function bbloomer_override_postcode_validation( $address_fields ) {
  $address_fields['postcode']['required'] = false;
  return $address_fields;

PHP Snippet (Alternative #2): Disable Postcode/ZIP Validation @ WooCommerce Checkout

* @snippet       Disable Postcode/ZIP Validation @ WooCommerce Checkout
* @how-to        Get CustomizeWoo.com FREE
* @sourcecode    https://businessbloomer.com/?p=20203
* @author        Rodolfo Melogli
* @testedwith    WooCommerce 3.5.3
* @donate $9     https://businessbloomer.com/bloomer-armada/

add_filter( 'woocommerce_checkout_fields' , 'bbloomer_alternative_override_postcode_validation' );

function bbloomer_alternative_override_postcode_validation( $fields ) {
$fields['billing']['billing_postcode']['required'] = false;
$fields['shipping']['shipping_postcode']['required'] = false;
return $fields;

Official Documentation


Where to add custom code?

You should place PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my guide "Should I Add Custom Code Via WP Editor, FTP or Code Snippets?" and my video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything went 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.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

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.

27 thoughts on “WooCommerce: Disable Postcode/ZIP Validation @ Checkout

  1. Hi Rodolfo. Love your code snippets!
    However in this case, you are making the field not mandatory – it becomes optional with your code. I guess by definition, if it’s optional then there’s no validation.
    But if you want to keep the field as mandatory but remove the validation of the post code (so you can add any text in there) then I suggest the following:

    1. Nice!

  2. Greetings Rodolfo,

    First off, great work with all the information and snippets you provide. They’ve proven to be very usefull in the past allready!
    I’ve tried your snippet to disable address validation but can’t seem to get it to work. Our client sells to customers in France and it’s custom there to write the housenumber in front of the street name, eg. “1 Place general”. Woocommerce triggers a validation error on this. using your code provided, I’ve used the snippet below but this doesn’t seem to work. Do you have any further advice for this perhaps?

    1. Hey Nikolaj, 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!

  3. Hi!
    I have tried both of these code one by one and twist, but no changes on invalid and required. My Woocommerce version is 5.0.2 .Can you help me to solve this. Please!

    1. Hey Nur, thanks so much for your comment! I just retested this on the latest version of WooCommerce and it still works. Unfortunately this looks like custom troubleshooting work and I cannot help here via the blog comments. Thanks a lot for your understanding! ~R

  4. Hi,
    Trying to do this but getting the following error;
    Your PHP code changes were rolled back due to an error on line 1131 of file wp-content/themes/oceanwp/functions.php. Please fix and try saving again.
    syntax error, unexpected ‘add_filter’ (T_STRING), expecting function (T_FUNCTION)

    1. Hey James, thanks for your comment! I checked again and it seems there is nothing wrong with my snippets – maybe you lost a comma or something else while copying/pasting?

  5. Thanks,
    The first actually works for me.
    But the second . . . it didn’t

    Inasmuch as the first code solved the problem, I was so excited.
    Once again thanks.

    1. Great 🙂

  6. When I use either of these alternatives, it works great. However, I use calculated shipping as I ship all over the world and the shipping no longer calculates at all. Do I have to provide flat rate or free shipping for this to work properly? Does Woocommerce depend on the zip code field to use calculated shipping?

    1. Hey Sara, thanks so much for your comment! WooCommerce might depend on zip code if the shipping methods do in the settings. Other than that, you probably have some other problem (incompatible theme, error in the PHP, etc)

    2. Try completing all fields that are required. Usually is zip is optional woocommerece calculates according to another field.

  7. I’ve just tried this and added both snippets into my theme’s functions.php file worked like a charm thank you.

  8. Yes, I’m afraid it doesn’t remove the validation. It does remove the required astrick, however. Still on the hunt for the validation part of it.

    1. Ok – I added a second alternative, let me know 🙂

  9. it doesnt remove post code input, but it disable required field. Thanks for solution.

  10. I wish to totally remove the e-mail requirement and the compulsory option that is on the checkout page.I am shown that this requirement is basic for the purpose of validation but I dont need it because my site uses M-pesa mostly for purchases and the service is virtual so this requirement puts off my customers. the only requirements i need on the check out are name, country and phone number,pls assist.

    1. Hey Samuel, thanks for your comment! Unfortunately the email is the only field you can’t really remove 🙂

  11. Hi Rodolfo, I tried your snippet in my child theme functions.php file and it removed the asterisk for a required field, but I still get the validation error. I have the latest woocommerce version 2.6.14. Any ideas?

    1. Hey Jason, thanks for your comment! I tested the snippet on the same version and I didn’t get any error. What country did you select in the checkout?

  12. You have saved the day! Cheers for the snippet 🙂

    Presume this could disable required for State / County too?

    1. Glad to hear that Steve, thanks for your comment! And yes, you can do the exact same with other fields e.g.:

      // disable validation for State 
      $address_fields['state']['required'] = false;
  13. Thanks for the article, it would be better if you would update the snippet that only selected countries will make the postcode validation false. For example:

    When you select ireland, postcode validation is not required. But if you select united kingdom, postcode validation is required.

    What do you think??

    1. Thank you Jake, that’s a good idea! However, the fix you suggested is not simple at all as fields cannot be removed “dynamically” once the country is selected. It’s not a PHP-only job 🙂 I’ll think about it and see if I can come up with something hopefully. Cheers!

Questions? Feedback? Support? Leave your Comment Now!

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. 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 BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

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