How to limit free samples to 3 per Shopify order at checkout
Short answer: Cap the combined quantity of sample-tagged products at 3 per order, checking inside checkout even when a shopper skips the cart page. In Checkpost, choose “Maximum 3 samples per order” from Templates, adjust the values, test it, then save and enable the rule.
The problem
A fragrance merchant offered three samples per order and found that shoppers could skip cart warnings to order more. Checkout enforcement checks the combined sample quantity rather than trusting the cart interface.
Related merchant discussion on Shopify Community
How to set it up
- Install Checkpost from the Shopify App Store.
- Open Templates and choose Maximum 3 samples per order.
- Tag all sample products and set the per-order allowance. Configure free sample pricing separately.
- Use Try this rule to test a sample cart, then click Save rule.
The rule
Checkout is blocked when all of these conditions is true:
- Combined quantity of products (products tagged sample) is greater than 3
Shoppers see: “Choose up to 3 samples per order. Please remove the extra samples.” at the top of checkout, in the cart and at checkout.
Rule definition (JSON)
{
"name": "Samples: max 3 per order",
"match": "all",
"conditions": [
{
"kind": "line_number",
"field": "matching_quantity",
"op": "gt",
"value": 3,
"filter": {
"productTags": [
"sample"
]
}
}
],
"message": "Choose up to 3 samples per order. Please remove the extra samples.",
"target": "cart",
"runOn": "always"
}Examples with the default settings
These outcomes apply to this rule alone. Other enabled rules may also affect checkout.
| Test cart | Expected outcome |
|---|---|
| 2 rose samples + 1 citrus sample | Allowed by this rule |
| 2 rose samples + 2 citrus samples | Checkout blocked |
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
- Tag every sample product sample, including each scent sold separately.
- Combine this with the qualifying-product rule if sample-only orders should also be refused.
- Keep your sample pricing and discount setup separate. This policy neither makes samples free nor limits purchases across a customer's lifetime.
FAQ
Does three mean three scents or three units?
Three units in total. Two units of one scent and one of another use the full allowance.
Does the customer have to visit the cart page?
No. The validation also runs at supported Shopify checkout entry points; a cart-page warning is not the enforcement mechanism.
Related rules
Block disposable email domains
Stop checkouts that use throwaway email domains often linked to fraud, coupon abuse and reseller bots.
Block specific emails or addresses
Prevent known fraudsters or serial returners from checking out by email, or by tagging their customer accounts.
Stop card-testing bots
Block tiny guest orders — the classic pattern bots use to test stolen card numbers — while logged-in customers shop normally.