How to limit address field length at Shopify checkout for carrier labels
Short answer: Stop addresses that are too long for your carrier's label format (often 35 characters) before they cause failed shipments. In Checkpost, choose “Limit address line length” from Templates, adjust the values, test it, then save and enable the rule.
The problem
Many carrier label formats truncate address lines at 35 characters, and some 3PLs reject longer ones outright. Long lines lead to failed label creation or misdelivery.
How to set it up
- Install Checkpost from the Shopify App Store.
- Open Templates and choose Limit address line length.
- Set the maximum length your carrier supports.
- 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 is longer than (characters) 35
- Address line 2 is longer than (characters) 35
- Company is longer than (characters) 35
Shoppers see: “Address lines must be 35 characters or fewer. Please move extra details to the second line.” at the address line 1, once they reach checkout.
Rule definition (JSON)
{
"name": "Address line max 35 chars",
"match": "any",
"conditions": [
{
"kind": "text",
"field": "ship_address1",
"op": "length_gt",
"values": [
"35"
]
},
{
"kind": "text",
"field": "ship_address2",
"op": "length_gt",
"values": [
"35"
]
},
{
"kind": "text",
"field": "ship_company",
"op": "length_gt",
"values": [
"35"
]
}
],
"message": "Address lines must be 35 characters or fewer. Please move extra details to the second line.",
"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 your carrier's documented limit. 35 is common, but some allow 30 or 50.
- Suggest moving apartment or building details to line 2 in the message.
FAQ
Does it count spaces?
Yes, after trimming leading and trailing spaces.
Can I limit the name fields too?
Yes. Add conditions for first or last name with the same length operator.
Related rules
Latin characters only in address
Block non-Latin scripts in address fields when your carrier or warehouse system can only print Latin characters.
Require company name for wholesale
Require a company name in the shipping address when a wholesale customer checks out, keeping invoices and deliveries accurate.