To discount a collection only when a certain product is in the cart, use OneCode: Stackable Discounts. Add a Product In Cart condition under Global Conditions, then add a Product Discount that targets the collection. The collection is discounted while that product is in the cart, and goes back to full price when it is removed.
Example: the code BEANIEBONUS gives 20% off the Accessories collection when a Merino Beanie is in the cart. A customer with a $32 beanie and a $30 tote from Accessories pays $24 for the tote, and the beanie stays at $32. A customer who buys the tote on its own gets no discount.

Set it up
- In OneCode, click Create discount. Keep Discount code and enter
BEANIEBONUS, or choose Automatic discount and give it a Title. - Under Global Conditions, click Add Condition. Set Field to Product In Cart, keep Operator on Contains, click Browse, and pick the Merino Beanie.
- Click Add Discount Type. Keep Discount Type on Product Discount and Value Type on Percentage, and enter
20in Percentage. - Set Target to Specific Collections, click Browse, and pick Accessories.
- Click Save discount.
Things to check before you launch
- If the beanie is also in Accessories, it gets 20% off too. To keep it at full price, set Target to Specific Products and pick the accessories you want discounted instead of the collection.
- One beanie in the cart gives 20% off every accessory in the cart. To discount only one accessory, click Add quantity limit and enter
1in Quantity Limit. With Apply discount to on “Cheapest items first”, the cheapest accessory gets the discount. - Product In Cart applies to the whole discount, so every discount type on this code needs the beanie in the cart. If you want a second offer with a different trigger product, create a second discount.
Add free shipping to the same code
Click Add Discount Type, set Discount Type to Shipping Discount, and keep Free Shipping. Because the beanie condition covers the whole discount, shipping is free only when the beanie is in the cart.
If you would rather leave the product discount open to everyone and make shipping cheaper only when that discount applies, see cheaper shipping when the discount applies.
OneCode costs $9.90 USD every 30 days after a 7-day free trial, billed by Shopify. Install it from the Shopify App Store.
