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, in every language your customers actually type.

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. That catches roughly a third of real cases. Customers type:

  • 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

This is one of the rules in PS: Checkout Rules, alongside requiring house numbers, restricting zip codes and countries, and controlling which shipping and payment methods appear. There is a free plan.

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.