Free Gift Kit
Give a free gift when a cart reaches a minimum. You get the Buy X Get Y discount that makes the gift free, and a small theme snippet that adds it to the cart, because Shopify never does.
What you’ll need
The variant ID (or the admin link)
How to get this: The variant ID
- Open the product, then click the variant. The ID is the number after /variants/ in the web address.
- You can paste the whole link instead; the tool finds the number.
Shopify’s free GraphiQL app (with read_products, write_discounts access)
How to get this: Shopify’s free GraphiQL app
- Install it once from shopify-graphiql-app.shopifycloud.com: enter your store address, tick the access listed here, click Install and approve.
- Then open it any time from Apps › Shopify GraphiQL App in your admin.
A duplicate of your theme to test on
How to get this: A duplicate of your theme to test on
- Online Store › Themes › … on your theme › Duplicate.
- Make the change on the copy, preview it, and publish only when it works.
The theme code editor (to paste a snippet)
How to get this: The theme code editor
- On the copy of your theme: … › Edit code.
- Hover the snippets folder, click New File…, name it as the tool says, paste and Save.
1The offer
In your store’s currency, before discounts. $50 to $100 is common.
The number after /variants/ on the gift’s page in your admin, or the whole link.
Try:
Check the gift and find collection IDs (read-only)
Run in GraphiQL with read_products. Variables: {"variant": "gid://shopify/ProductVariant/…", "collections": "title:all*"}. Paste the result below to check the gift can be added to carts.
query GiftLookup($variant: ID!, $collections: String!) {
productVariant(id: $variant) {
id
title
price
inventoryQuantity
availableForSale
product {
id
title
status
handle
}
}
collections(first: 25, query: $collections) {
nodes {
id
title
handle
}
}
}2Check the plan
3Create the discount
4Theme snippet
[remaining] becomes the amount or items left.
Install
- In your admin, go to Online Store > Themes. On your live theme click … > Duplicate, and work on the copy first.
- On the copy, click … > Edit code. Under Snippets, click Add a new snippet, name it est-gwp, paste the snippet, and save.
- Open layout/theme.liquid and paste {% render 'est-gwp' %} on its own line just above </body>. Save.
- Optional: to show “Spend X more for a free gift”, add <div data-est-gwp-progress></div> where you want the message (for example in the cart drawer or cart page section).
- Preview the copy, and run the test checklist below on a development store or with the discount active.
- When everything works, publish the copy (or repeat these steps on your live theme).
Cart drawers
- Dawn and Shopify’s free themes built on it (Refresh, Sense, Craft, Studio, Taste, Crave, Origin, Ride, Colorblock, Spotlight, Publisher, Trade): The drawer and count update in place: Shopify’s standard updateCart action recognises Dawn, and without it the snippet uses Dawn’s own cart-update event.
- Horizon and themes built on it: Updates in place through Shopify’s standard updateCart action, which recognises Horizon’s cart.
- Other themes: Shopify’s updateCart action reloads the page after the gift is added or removed when it doesn’t recognise the theme’s cart. If your theme sends no cart events and has no standard actions, the cart page reloads once and a cart drawer may show the gift the next time it opens. Your developer can listen for the est-gwp:change event to refresh the drawer.
- Themes with an “upsell” or “free gift” feature, or a gift app: Turn those off for the same gift, or two things will add it.
Test checklist
- Add items just under the minimum: no gift is added, and the progress message shows what’s left to spend.
- Reach the minimum: the gift is added once, at 0.00, with the discount title next to it.
- Remove items to go back under the minimum: the gift is taken out.
- Remove the gift yourself while over the minimum: it stays out for the rest of the visit.
- Change the gift’s quantity to 2: it goes back to 1 (only one is free).
- Add the gift product on its own from its product page, with nothing else: it is not free, and it isn’t doubled.
- Use a discount code at the same time: check which discounts apply at checkout.
- Switch to another currency or market (if you sell in several): the gift appears at the converted minimum.
- Open the cart drawer and the cart page on a phone: the gift line and the count update without a manual refresh.
- Deactivate the discount: the gift is no longer free and the snippet takes it out of carts.
Uninstall
- In snippets/est-gwp.liquid, change "addGift": true to "addGift": false and save. New gifts stop; gifts that aren’t free anymore are still taken out of carts.
- Deactivate the discount (Discounts > the gift discount > Deactivate, or run the undo mutation on this page).
- A few days later, delete the line {% render 'est-gwp' %} from layout/theme.liquid, delete snippets/est-gwp.liquid, and remove any <div data-est-gwp-progress></div> you added.
- Nothing else was changed: the snippet adds no settings, files, apps or theme styles.
5Check the result, or undo
Guides
Questions
Can a shopper end up paying for the gift?
The snippet checks Shopify’s own cart: after adding the gift, the gift line must cost 0. If Shopify didn’t make it free (discount off, cart below the minimum), the snippet takes it straight back out and doesn’t retry for that cart.
Will it work with my theme’s cart drawer?
Dawn- and Horizon-based themes update in place. Other themes reload the page or show the gift the next time the drawer opens. Test on a duplicate of your theme first.
How do I remove it?
Set "addGift" to false in the snippet, deactivate the discount, and a few days later delete the snippet file and the line that renders it. Nothing else in your theme is changed.
Is anything uploaded?
No. The kit is built in your browser. You create the discount and add the snippet yourself.
Based on Shopify’s discountAutomaticBxgyCreate reference (API 2026-10), Buy X get Y discounts, the Cart AJAX API and updateCart.