Checkpost

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

  1. Install Checkpost from the Shopify App Store.
  2. Open Templates and choose Block PO Box addresses.
  3. Add local spellings such as "Postfach" or "Apartado" if you ship internationally.
  4. 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:

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

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

Add block po box addresses to your store