How to require a main product before an add-on can be purchased on Shopify
Short answer: Block checkout when an add-on (warranty, installation, engraving) is in the cart without the product it belongs to. In Checkpost, choose “Add-ons require a main product” from Templates, adjust the values, test it, then save and enable the rule.
The problem
Warranties, installation, engraving and refills only make sense with the main product. Orders for an add-on alone lead to refunds and confused customers.
How to set it up
- Install Checkpost from the Shopify App Store.
- Open Templates and choose Add-ons require a main product.
- Tag add-ons and main products.
- Use Try this rule to test a sample cart, then click Save rule.
The rule
Checkout is blocked when all of these conditions are true:
- Cart contains products tagged add-on
- Cart does not contain products tagged main-product
Shoppers see: “Add-ons can only be purchased together with a main product.” at the top of checkout, in the cart and at checkout.
Rule definition (JSON)
{
"name": "Add-on without main product",
"match": "all",
"conditions": [
{
"kind": "cart_contains",
"filter": {
"productTags": [
"add-on"
]
}
},
{
"kind": "cart_not_contains",
"filter": {
"productTags": [
"main-product"
]
}
}
],
"message": "Add-ons can only be purchased together with a main product.",
"target": "cart",
"runOn": "always"
}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 add-ons and their compatible main products with consistent tags.
- For product-specific pairs, create one rule per pair using selected products.
FAQ
Can one add-on work with several main products?
Yes. Give all compatible main products the same tag.
What if the main product was bought earlier?
Checkout rules see the current cart only. Sell standalone add-ons as a separate product without the add-on tag.
Related rules
Don't mix pre-orders with in-stock items
Require pre-order items to be checked out separately so in-stock items aren't held back waiting for pre-order stock.
Samples need a qualifying full-size product
Block checkout when sample-tagged products are present without a product tagged sample-qualifier, so samples accompany a qualifying full-size purchase.