Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Postal code validation rejecting valid foreign codes: fix it

PRF-362High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

A postal code (called a ZIP code in the US, a postcode in the UK) is the short code that identifies a delivery area. Formats differ a lot by country. The US uses 5 digits. The UK uses letters and digits with a space. Canada alternates letters and digits. Ireland uses a 7-character Eircode. Some countries, such as Hong Kong, have no postal codes at all.

Examples of valid postal code formats by country
CountryExampleFormat
United States90210 or 90210-12345 digits, optional 4
United KingdomSW1A 1AALetters and digits, 5-7 characters plus a space
CanadaK1A 0B1Letter-digit-letter, space, digit-letter-digit
Netherlands1012 AB4 digits, 2 letters
IrelandD02 X2853 characters, space, 4 characters
Germany101155 digits
Hong Kong(none)No postal code system

Why it costs you leads or sales

The error appears at the very end of the form or checkout, when the visitor is ready to buy or book. They typed a correct code and are told it is wrong. Most will not try tricks like entering a fake US ZIP. They leave, and you never see the lost sale because no order or lead is created.

Where an international buyer is lost
  1. Product pageVisitor from Canada adds item
  2. CartProceeds to checkout
  3. Address formK1A 0B1 rejected as invalid
  4. PaymentNever reached
  5. Order confirmationNever reached

The postal code rule blocks the shipping step, so everything after it is lost.

Checkout completion by countryExample numbers
Checkout completion by country (example)US visitors: 62 %; UK visitors: 8 %; Canada visitors: 6 %024486286US visitorsUK visitorsCanada visitors%

Example: illustrative completion rates for visitors who reach the address step. Your own numbers will differ.

How to check if your site has it

Test your form with real foreign codes
  1. List the countries you sell or serve

    Check your shipping zones or the countries in your country dropdown.

  2. Pick one valid code per country

    Use the examples in the table above, or a real address from a post office website. Include a code with a space and one in lower case.

  3. Submit the form in a private window

    Select the country first, then type the code. Also test the opposite order: type the code, then change the country.

  4. Test countries with no postal codes

    Choose a country such as Hong Kong or Ireland-adjacent regions without codes where applicable and check that the field is not forced.

  5. Read the page source or form settings

    Look for pattern=, maxlength=5, type="number" or a regex in custom JavaScript. These are the usual culprits.

How to fix it

There are two safe approaches. The best is to pick the rule from the selected country. The simplest is to accept any non-empty text and let your carrier or address check catch real mistakes. A wrong-but-accepted code is cheaper than a lost order.

Fix by platform
  1. Find where the rule comes from

    In WooCommerce, postcode validation follows the country chosen in Settings > General > Selling location(s). Deactivate custom checkout plugins or snippets one at a time to find the one adding a ZIP-only rule.

  2. Fix form plugins

    In Contact Form 7, Gravity Forms, WPForms or similar, change the field to a plain text field and remove any pattern or number-only validation. Gravity Forms has an International address type that does not force a US ZIP.

Per-country postal code check with a safe fallbackjavascript
const postalRules = {
  US: /^\d{5}(-\d{4})?$/,
  GB: /^[A-Za-z]{1,2}\d[A-Za-z\d]? ?\d[A-Za-z]{2}$/,
  CA: /^[A-Za-z]\d[A-Za-z] ?\d[A-Za-z]\d$/,
  NL: /^\d{4} ?[A-Za-z]{2}$/,
  DE: /^\d{5}$/
};

function isPostalCodeOk(country, value) {
  const code = value.trim();
  if (code === '') return false;
  const rule = postalRules[country];
  if (!rule) return code.length <= 12; // unknown country: accept
  return rule.test(code);
}
Postal code rule

Before

  • One pattern: 5 digits for every country
  • Field type is number
  • UK, Canadian and Dutch codes show an error
  • Visitors abandon at the address step

After

  • Rule chosen from the selected country
  • Field type is text, spaces allowed
  • Unknown countries accept any short value
  • Address step completes for every market

How to confirm it's fixed

Confirmation checks
  • A valid code from each target country is accepted
  • Codes with a space, lower case or hyphen are accepted
  • A clearly wrong value (for example 'abc') still shows a helpful message
  • Codes with leading zeros keep the zero
  • Countries without postal codes can submit without one
  • The submitted code appears correctly in the order, email and CRM
  • Test on mobile as well as desktop

How to prevent it happening again

Theme updates, new form plugins and checkout apps can bring back a US-only rule. Keep a short list of test addresses, one per market, and run them after any change to forms, checkout or plugins. When you open a new market, add its code to the list before launch. Ask developers to use a maintained address library instead of hand-written patterns.

How FunnelGuard handles this

FunnelGuard does not check this yet. Testing postal codes from many countries is a possible future check, but today it is not something FunnelGuard reports on.

What FunnelGuard does do is run your real lead form or checkout journey on a schedule, from the EU or the US, and check each step. If a form stops submitting, a step breaks, or a test lead never reaches your inbox or CRM, you get one alert with a screenshot and a likely cause after a second-region re-check. That helps if a bad validation change blocks the standard journey, but it will not tell you that a Canadian code is being rejected.

To watch for this issue, keep the manual test list above and rerun it after changes. You can also review your analytics for a drop in completed checkouts from non-US countries, and ask support to flag customer emails that mention an invalid postcode. The Free plan (1 site, 2 journeys, daily checks) is a way to monitor your main journey in the meantime.

How the problem usually unfolds
  1. Day 1

    A developer adds a 5-digit ZIP rule for the US launch.

  2. Month 2

    Ads start reaching UK and Canadian visitors.

  3. Month 2 onward

    Foreign buyers hit an invalid code error and leave. No error is logged.

  4. Month 4

    Someone notices low international conversion and tests a UK code.

  5. Fix day

    Rule is switched to per-country validation and orders recover.

Questions people ask

Why does my checkout say my postcode is invalid?

The form is probably using a rule built for one country, often five digits for US ZIP codes. A valid UK, Canadian or Dutch code does not match that pattern, so it is rejected. The fix is to validate based on the selected country or loosen the rule.

How do I validate international postal codes on a form?

Choose the pattern from the country the visitor selected, and fall back to a simple length check for countries you have no rule for. Use a text field, not a number field, and allow spaces and hyphens. A maintained address library is safer than hand-written patterns.

Should the postal code field be required for every country?

No. Some countries, such as Hong Kong, do not use postal codes. Make the field required only when the selected country uses them, otherwise buyers from those countries cannot finish the form.

Why does my form drop the leading zero from a ZIP code?

The field is likely set to type number, which treats the value as a numeric amount and removes leading zeros. Change the input to type text. This also lets letters and spaces through for UK and Canadian codes.

How do I test if my website rejects foreign postal codes?

Select each country you serve, enter a real valid postal code for it, and submit the form in a private window. Also test lower case, extra spaces and the order of selecting country and code. Repeat after any plugin, theme or checkout change.

Can FunnelGuard detect postal code validation errors?

Not yet. FunnelGuard does not check postal codes from different countries, though it could be a future check. It does run your real form or checkout journey on a schedule and alerts you if the journey itself breaks.

Is it safe to just accept any postal code?

Yes, for most lead forms and many shops. A mistyped code is less costly than a lost order. If accuracy matters for shipping, validate per country and confirm the address with your carrier or an address-check service.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: intl_input_accepted on language / country variant runs (Stage 28): the country's real test postcode; postcode errors in 9 languages.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.