Why Does WooCommerce Reject a Valid Postcode or ZIP Code?

How WooCommerce Validates Postcodes

Postcode formats vary significantly by country — some are purely numeric, others mix letters and numbers with specific spacing rules, and WooCommerce maintains built-in validation patterns matched to the country selected in the address fields. A legitimate postcode can still fail this check if the selected country doesn't match where the postcode is actually from, or if the specific format entered (extra spaces, unexpected capitalization) doesn't align with what the validation pattern expects.

Common Causes of a Rejected Postcode

  • Wrong country selected relative to the postcode being entered — an easy mistake for a customer to make, and it will reliably trigger a validation failure since the pattern is country-specific.
  • Formatting differences (extra spaces, lowercase letters where uppercase is expected) that a strict pattern doesn't normalize before validating, even though the postcode is otherwise correct.
  • An edge-case or newly introduced postcode format for a specific region not yet reflected in WooCommerce's built-in validation patterns, which does happen occasionally as postal systems evolve.
  • A plugin or customization overriding postcode validation with a stricter or incorrect pattern than WooCommerce's own default.

How to Diagnose and Fix It

  1. Confirm the correct country is selected relative to the postcode being entered, which resolves a surprising number of cases.
  2. Check for unusual formatting (extra spaces, unexpected characters) in the entered postcode.
  3. If the postcode is genuinely valid and still rejected, WooCommerce's woocommerce_validate_postcode filter can adjust or bypass validation for a specific known edge case.
  4. Check for a plugin overriding validation if the issue doesn't match a standard WooCommerce pattern limitation.

Customers being blocked from completing valid orders? See WooCommerce fixes.

Checking the store side

  1. Test the same postcode cleanly. Try it with the correct country selected, with and without spaces, and in uppercase, to separate a formatting issue from a genuine rejection.
  2. See whether it happens on billing, shipping or both. The countries you sell to and ship to are set separately in WooCommerce's general settings, and a mismatch can make a valid address fail on one form only.
  3. Look for custom validation. If code or a plugin hooks into woocommerce_validate_postcode, disable it temporarily. A stricter custom pattern is a common cause.
  4. Keep WooCommerce updated. Its postcode patterns are maintained in core, so format changes in a country's postal system arrive through updates.

When a genuine postcode is rejected

If you've confirmed a real postcode for a specific country keeps failing, a temporary workaround is to accept it for that country only, while the pattern is corrected upstream. Use this sparingly, since it turns validation off for that country:

add_filter( 'woocommerce_validate_postcode', function ( $valid, $postcode, $country ) {
	if ( 'XX' === $country ) { // replace XX with the two-letter country code
		return true;
	}
	return $valid;
}, 10, 3 );

Available for new projects

NEXT STEP

Rather have it fixed than keep reading?

Based in Dhaka, Bangladesh — serving clients worldwide. Tell me what's happening and you'll have a reply within one working day.

  • Reply within one working day
  • Fixed quote before work starts
  • UK, EU and US hours covered