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
    1. Open the product, then click the variant. The ID is the number after /variants/ in the web address.
    2. You can paste the whole link instead; the tool finds the number.

    Step-by-step guide (opens in a new tab)

  • Shopify’s free GraphiQL app (with read_products, write_discounts access)

    How to get this: Shopify’s free GraphiQL app
    1. Install it once from shopify-graphiql-app.shopifycloud.com: enter your store address, tick the access listed here, click Install and approve.
    2. Then open it any time from Apps › Shopify GraphiQL App in your admin.

    Step-by-step guide (opens in a new tab)

  • A duplicate of your theme to test on

    How to get this: A duplicate of your theme to test on
    1. Online Store › Themes › … on your theme › Duplicate.
    2. Make the change on the copy, preview it, and publish only when it works.

    Step-by-step guide (opens in a new tab)

  • The theme code editor (to paste a snippet)

    How to get this: The theme code editor
    1. On the copy of your theme: … › Edit code.
    2. Hover the snippets folder, click New File…, name it as the tool says, paste and Save.

    Step-by-step guide (opens in a new tab)

Get the snippet

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

Sources: Shopify Help Center: Combining discounts, GraphQL Admin API 2026-10: discounts.

Updated .