Automatically add a product to the cart at checkout
In short
Create a rule under Rules with the conditions that should trigger it, then add a Modify Cart action and choose Add Product. Pick the product variant and quantity, and keep Prevent adding duplicate products on so the product is added once. The Rules Executor block must be in your checkout.
✓ Applies to
- Deluxe plan only (checkout rules aren't included in Advanced)
- Shopify Plus checkout, with the Rules Executor block added
- Adding a variant to the cart, or setting the quantity of a variant already in the cart
✕ Doesn't apply to
- Making the added product free. Use a Shopify discount for that
- Removing a product from the cart
Before you start
- Add the Rules Executor app block to your checkout. How to add it.
- The product must be for sale on your Online Store channel and in stock, or not tracking inventory. Shopify rejects cart changes for products buyers can’t buy.
Steps
Add a product
- In Checkout Ninja, open Rules and click New checkout rule.
- Enter a Title, up to 30 characters.
- Under Condition, click Add condition and set when the product should be added. For example, Cart Total Greater Than
100. - Under Action, click Add Action and choose Modify Cart - Add Product / Update Product Quantity.
- Choose Add Product.
- Under Product Variant, select the product and the variant to add. If your selection has several variants, only the first is added.
- Enter a Quantity. Leave it empty to add 1.
- Keep Prevent adding duplicate products ticked. It’s on by default.
- (Optional) Turn on Limit total quantity in cart and enter a Maximum quantity allowed.
- Set Status to Active and click Save.
If you untick Prevent adding duplicate products, the rule adds the product again every time it runs while the conditions match, and the app shows Warning: Risk of Duplicate Products. Only do this together with Limit total quantity in cart.
Set a product’s quantity
Use this to fix the quantity of a variant that’s already in the cart, for example to allow only one of a limited item.
- Follow steps 1 to 4 above.
- Choose Set Product Quantity.
- Under Product, select the product and variant.
- Enter the Quantity to set.
- Set Status to Active and click Save.
How the add options work together
| Prevent adding duplicate products | Limit total quantity in cart | What happens when the rule runs |
|---|---|---|
| On | Off | Adds the product once. Skips if the variant is already in the cart. |
| On | On | Same as above. The limit has no extra effect, because the product is never added a second time. |
| Off | On | Adds the quantity each time the rule runs, until the variant’s cart quantity reaches the maximum. |
| Off | Off | Adds the quantity every time the rule runs. Avoid this. |
Verify it worked
- Open your checkout with a cart that matches the rule. The product appears in the order summary.
- Change something in the checkout, such as the shipping address. The product isn’t added a second time.
- Test a cart that doesn’t match. The product isn’t added.
Limitations
- Shopify Plus only, because the rule runs in the Rules Executor checkout block.
- The product is added at its full price. Use a Shopify discount to make it free or cheaper.
- The product isn’t removed when the conditions stop matching.
- Set Product Quantity only changes a variant that’s already in the cart. It doesn’t add the variant. A quantity of
0or an empty quantity is treated as 1, so this action can’t remove a product. - The same variant is never added twice within 2 seconds, even with duplicates allowed. This stops double adds when the checkout updates quickly.
Troubleshooting
The product isn’t added. Check that the variant is available for sale and in stock, and that the rule is Active and the Rules Executor is in your checkout. With Prevent adding duplicate products on, nothing happens if the variant is already in the cart. Full checklist.
The wrong variant is added. The action uses the first variant in your selection. Open the rule, clear the Product Variant selection and pick only the variant you want.
Set Product Quantity does nothing. The variant isn’t in the cart. This action only changes existing lines. Pair it with an Add Product action, or a condition such as Variant in cart.
Frequently asked
Is the added product free? +
No. It's added at its normal price. To give it away, create an automatic discount in Shopify for that product.
Is the product removed if the conditions stop matching? +
No. Modify Cart only adds products or sets quantities. The product stays in the cart until the buyer removes it.
Can the buyer remove the product? +
Yes. But if the rule still matches, the next time the checkout changes the Rules Executor adds it again.
Why was the product added several times? +
Prevent adding duplicate products was turned off. With it off, the rule adds the product every time it runs while the conditions match. Turn it back on, or set a quantity limit.