How to block PO Box addresses at Shopify checkout
Short answer: Stop checkout when the shipping address contains a PO Box, so carriers that cannot deliver to PO Boxes never receive the order. In Checkpost, choose “Block PO Box addresses” from Templates, adjust the values, test it, then save and enable the rule.
The problem
Couriers such as UPS, FedEx and DHL cannot deliver to PO Boxes. When a shopper enters one, the parcel bounces back, you pay return shipping, and the customer waits days for a reship. Stores shipping large, heavy or signature-required items feel this most.
How to set it up
- Install Checkpost from the Shopify App Store.
- Open Templates and choose Block PO Box addresses.
- Add local spellings such as "Postfach" or "Apartado" if you ship internationally.
- Use Try this rule to test a sample cart, then click Save rule.
The rule
Checkout is blocked when any of these conditions are true:
- Address line 1 matches pattern \bp\.?\s*o\.?\s*box\b, \bpost\s*office\s*box\b
- Address line 2 matches pattern \bp\.?\s*o\.?\s*box\b, \bpost\s*office\s*box\b
Shoppers see: “We can't ship to PO Boxes. Please enter a street address.” at the address line 1, once they reach checkout.
Rule definition (JSON)
{
"name": "No PO Box addresses",
"match": "any",
"conditions": [
{
"kind": "text",
"field": "ship_address1",
"op": "matches_regex",
"values": [
"\\bp\\.?\\s*o\\.?\\s*box\\b",
"\\bpost\\s*office\\s*box\\b"
]
},
{
"kind": "text",
"field": "ship_address2",
"op": "matches_regex",
"values": [
"\\bp\\.?\\s*o\\.?\\s*box\\b",
"\\bpost\\s*office\\s*box\\b"
]
}
],
"message": "We can't ship to PO Boxes. Please enter a street address.",
"target": "address1",
"runOn": "checkout"
}Where this rule works
These are cart and checkout validations, including supported accelerated checkouts. They are current-cart policies; they do not track previous purchases of a SKU. Shopify excludes POS, recurring subscription orders and native pre-order/Try Before You Buy flows from this API. See Shopify's validation compatibility.
Tips
- Check both address lines: shoppers often type the PO Box into line 2.
- The pattern matches "PO Box", "P.O. Box", "POBox" and "Post Office Box" in any letter case, but not words like "Boxwood".
- If you offer a postal service rate that does deliver to PO Boxes, add a second condition so the rule only applies when a courier rate is selected (Delivery method name contains "UPS").
Can you do this without an app?
Shopify has no built-in PO Box block. Address autocomplete reduces typos but does not stop PO Boxes.
FAQ
Will this block APO/FPO military addresses?
No. The default pattern only matches PO Box spellings. If you also want to block military addresses, add a second pattern such as \b(apo|fpo|dpo)\b to the rule.
Where does the error message appear?
Next to the Address line 1 field at checkout, so the shopper sees exactly what to fix.
Related rules
Block shipping to specific countries
Prevent orders from being placed with a shipping address in countries you cannot or do not want to serve.
Block specific ZIP / postal codes
Block checkout for postal codes you can't deliver to, using exact codes or prefixes (for example remote islands or rural areas).
Only allow listed postal codes (local delivery)
Allow checkout only when the shipping postal code is inside your delivery area — ideal for local bakeries, florists and grocery delivery.
Restrict products in certain states
Block checkout when a restricted product (for example knives, vapes, supplements or CBD) is shipped to a state or province where it can't be sold.