Shopify apps ·

How to block PO Box addresses at Shopify checkout

PO Boxes cause failed deliveries and chargebacks. Here is how to stop them at checkout, including Postfach, Packstation and other local spellings.

By Nikita Ahapov · Updated

Carriers like DHL Express, UPS and FedEx do not deliver to PO Boxes. When a customer enters one anyway, the order is accepted, paid for, and then fails somewhere in the fulfilment chain. You pay for the shipping label, the support ticket and often the refund.

The fix belongs at checkout, before the order exists.

Why the naive version breaks

Most attempts at this check for the string PO Box in address line one. Customers type it plenty of other ways:

  • P.O. Box, POBox, P O Box, PO-Box
  • Postbus in Dutch
  • Postfach in German
  • Boîte postale or BP in French
  • Apartado in Spanish
  • Skrytka pocztowa in Polish

If your store sells into Europe, a single English pattern is not enough. The address field also collects the value in whatever the customer’s keyboard produces, so accents and punctuation vary.

Where the check belongs

Shopify gives you three places to intervene, and only one of them is reliable.

Theme JavaScript. Runs before checkout, breaks on theme updates, and is trivially bypassed. Not a real control.

Checkout UI extension. Runs inside checkout, cannot be bypassed by the customer, and survives theme updates because it is not part of the theme.

Post purchase automation. Too late. The money has moved.

Checkout validation is the only one that actually prevents the order.

What a working rule looks like

The rule needs three things:

  1. A pattern list covering the languages of every market you sell to
  2. Normalisation before matching, so punctuation and case do not defeat it
  3. A message that tells the customer what to do, not just that they are wrong

That last point matters more than it sounds. A validation error that says “invalid address” produces a support ticket. One that says “we cannot deliver to PO Boxes, please enter a street address” produces a corrected order.

Doing it without building it

Shopify’s own Checkout Blocks app has an address blocker for PO boxes, military and diplomatic addresses and parcel lockers. Its help page does not say whether it catches local spellings like Postfach or Postbus, so test it with addresses from your own markets before you rely on it.

This is one of the rules in PS: Checkout Rules. PO Box blocking in 10+ languages is on the free plan. Pro, at $29.99 a month, adds house number, postcode, country and order value rules, and control over which shipping and payment methods appear.

If you would rather build it yourself, the shape above is what you need. The Checkout UI extension docs are the right starting point, and the pattern list is the part worth spending real time on.

← All notes

Need this built rather than explained?

Send the design or describe the problem. Fixed scope, fixed price, honest no if it is not a fit.