Free gift guide
Auto-add a free gift to the Shopify cart
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.
Safe by design
- Never adds when the gift variant is already in the cart.
- Keeps the gift at quantity 1.
- Leaves it out if the shopper removes it.
- Stops after 6 changes in 30 seconds, or when Shopify refuses to add (out of stock).
- Runs once even if rendered twice. Does nothing in the theme editor or on the password page.
Cart drawers
On storefronts with Shopify’s standard updateCart action, the drawer updates in place on Dawn- and Horizon-based themes, and other themes reload the page. Without it, the snippet uses Dawn’s cart-update event, refreshes the cart count, and reloads the cart page once. Developers can listen for the est-gwp:change event.
Progress message
Add <div data-est-gwp-progress></div> to the cart drawer or cart page to show “Spend $12.00 more for a free gift”.
More guides
- How to offer a free gift with purchase in Shopify without an app
- Why Shopify’s Buy X Get Y doesn’t add the free item
Sources: Shopify Help Center: Combining discounts, GraphQL Admin API 2026-10: discounts.