Free gift at checkout
What you’ll build: a gift product that’s added to the cart at checkout for free, optionally only when the customer qualifies (for example, orders over $100).
Requirements: Business plan (this recipe needs a function and a block) and Shopify Plus (for the block and the “Checkout components” discount area).
The gift is free because a 100% product discount applies to it. The block adds it to the cart because it sees the price is $0.
-
Create the discount. In Checkout Buddy, click Create customization and choose Product discount.
- Discount type: Percentage. Discount value:
100. - Discount message: for example
Free gift. - Variants applied to: your gift variant.
- Areas applied to: untick Cart, keep Checkout components (upsells, cross-sells, etc.). The gift is then only free when Checkout Buddy adds it, not when a customer buys it from your store.
- Save the function.
- Discount type: Percentage. Discount value:
-
Let blocks read the discount. Create the one-time
checkout_buddy.markingsvariant metafield definition with Storefront API access, following these steps. Without it the block can’t tell the gift is free, and won’t add it automatically. -
Create the block. Click Create customization and choose Upsell / Cross sell.
- Offer type: Cross sell (Add product to cart).
- Choose products by: Select products manually, then pick the same gift variant.
- Tick Add free products to cart automatically, then Add products only once per checkout session (if automatically added).
- Use any layout except Compact (columns).
-
Stop it being added twice. In Display rules, choose Show only when rules pass and add Cart excludes component product (type “component” in the rule picker’s search box to find it). The block now hides once the gift is in the cart.
-
Add your conditions (optional). Click AND and add, for example, Cart subtotal is more than
99.99. Save the block and note its ID in the Customizations list. -
Place it in checkout. Add a Checkout Buddy app block in the Checkout Editor and enter the block’s ID in Fixed block ID. See add a block to checkout. Any placement works, because an auto-added gift isn’t shown as an offer.
-
Test it with a real checkout. Remove the gift and check that it isn’t added again.
Variations
Section titled “Variations”- Gift with a specific product: add Cart products includes your main product as a display rule on both the block and the discount.
- Gift for a discount code: add Discount code includes
GIFTto the block’s rules. - Different gifts by spend: create one block per tier with mutually exclusive rules (for example under $100, and $100 or more), and list both IDs in the same app block’s Fixed block ID.
Troubleshooting
Section titled “Troubleshooting”- The gift is added but not free: check Disable custom attributes is off in the app block’s settings. The discount only applies to items the block marks as added by Checkout Buddy.
- The gift isn’t added: check the metafield definition exists with Storefront API access, the variant is in stock and available on your online store, and the block’s rules pass. Sold-out gifts are hidden automatically.
- The gift comes back after the customer removes it: tick Add products only once per checkout session.
- More help: discount not applying.
