Donum Studio
← Back to blog

Shopify Buy X Get Y Doesn't Add the Free Item to the Cart: Why, and 3 Ways to Fix It

You create a “Buy 2, get a tote bag free” discount in Shopify, a customer buys two items, and the order comes through without the tote bag. Or worse, the customer emails asking where their free gift is.

Nothing is broken. This is how Shopify’s buy X get Y discount works, and it’s one of the most common surprises for merchants running a free gift promotion.

What’s actually happening

Shopify’s documentation is clear about it:

Customers must add all items to their cart manually. The free or discounted “get” item is never automatically added to the cart.

The discount only changes prices. If the free item is in the cart, Shopify makes it free at checkout. If it isn’t, there’s nothing to discount, and the customer checks out without it.

The same applies when you use buy X get Y for “spend $50, get a free gift”: the minimum purchase amount unlocks the discount, but the gift still has to be in the cart.

Why this costs you

  • Customers miss the offer. Many shoppers skim promotions. If they don’t know to add the gift, they don’t get it, and the promotion doesn’t do its job.
  • Support tickets. “I was supposed to get a free gift” is an awkward email to answer after the order has shipped.
  • Confusion when the cart changes. If a customer adds the gift and then removes the items that qualified, the gift stays in the cart at full price. Some customers notice at checkout, some don’t.

Fix 1: make the offer impossible to miss

The simplest fix doesn’t change how the discount works. It makes sure customers know they have to add the gift themselves:

  • an announcement bar: “Spend $50 and add a free tote bag to your cart”,
  • a note on the product pages that qualify,
  • a message in the cart with a direct link to the gift product.

Good for: small or short promotions where you don’t want to install anything. Limits: it’s still a manual step, and some customers will still miss it. It doesn’t help when the cart changes after the gift was added.

Fix 2: add the gift with theme code

If you’re comfortable editing your theme, you can add the gift automatically with Shopify’s Cart API. The basic idea: whenever the cart changes, check whether it qualifies, and add or remove the gift.

// Simplified example: add a gift variant when the cart reaches $50
const GIFT_VARIANT_ID = 1234567890;
const THRESHOLD_CENTS = 5000;

async function syncGift() {
  const cart = await (await fetch("/cart.js")).json();
  const gift = cart.items.find((item) => item.variant_id === GIFT_VARIANT_ID);
  const qualifies = cart.items_subtotal_price - (gift ? gift.final_line_price : 0) >= THRESHOLD_CENTS;

  if (qualifies && !gift) {
    await fetch("/cart/add.js", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ items: [{ id: GIFT_VARIANT_ID, quantity: 1 }] }),
    });
  } else if (!qualifies && gift) {
    await fetch("/cart/change.js", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ id: gift.key, quantity: 0 }),
    });
  }
}

You still need the buy X get Y (or a similar) discount, so the gift is free at checkout. The code only takes care of putting it in the cart.

The example is the easy part. A version that works reliably has to handle much more:

  • When to run. Themes change the cart in different ways (cart page, cart drawer, quick add buttons), and there’s no single event that fires for all of them.
  • Refreshing the cart. After the code adds the gift, the cart drawer and the cart count need to update. Each theme does this differently.
  • Customers who remove the gift. If someone deliberately removes it, adding it straight back is frustrating.
  • Stock. If the gift sells out, the add-to-cart request fails.
  • Variants. If the gift comes in sizes or colors, someone has to choose one.
  • Theme updates. A theme update can break your custom code without warning.

Good for: one simple, long-running offer, if you or a developer can maintain the code. Limits: every new promotion, tier or gift means more code, and you own every edge case.

Fix 3: use an app that adds gifts for you

Free gift apps exist mainly to solve this problem. They add the gift when the cart qualifies, remove it when it no longer does, and show customers how close they are to the next reward.

They’re not all built the same way. Questions worth asking before you install one:

  1. Is the gift your real product, or a $0 duplicate? Many apps create a copy of the gift priced at $0. It works, but it clutters your product list, can confuse inventory and fulfillment, and the copies can be left behind if you uninstall. We go through the trade-offs in Free Gift with Purchase Without Duplicate $0 Products.
  2. Is the discount checked at checkout? The app should apply the discount through Shopify’s own discount system, so a cart that no longer qualifies doesn’t keep the gift for free.
  3. What happens when the gift sells out? The app should stop adding it, rather than letting add-to-cart fail.
  4. Does it work with your cart drawer? Ask whether the gift and the progress message show up in your theme’s drawer, not just on the cart page.
  5. Does it respect customers who remove the gift?
  6. Can customers choose a variant, or between several gifts?

Which fix should you use?

Clear messaging Theme code App
Gift added automatically No Yes Yes
Removed when the cart no longer qualifies No If you code it Yes
Works in the cart drawer Not applicable Depends on your theme Depends on the app
Several tiers or gifts Manual More code Built in
Ongoing work None You maintain it The app developer maintains it
Cost Free Developer time Usually a monthly fee, often with a free plan

For a short, simple offer, clear messaging may be enough. For anything you’ll run often, or with more than one tier, an app saves you from maintaining your own cart logic.

How Donum: Free Gift with Purchase handles it

Donum: Free Gift with Purchase was built around the questions above:

  • Gifts are your real products, with no $0 copies. Each gift is made free by a Shopify discount and checked again at checkout.
  • Gifts are added when the cart qualifies and removed when it doesn’t. If a customer removes a gift, it isn’t added back during that visit.
  • Sold-out gifts are skipped and flagged in the app.
  • It works in the cart page and cart drawer, with a refresh setting for themes that need it.
  • Customers can choose their gift and its size or color on the Pro plan.
  • A progress bar shows how close the cart is to each reward.

It covers buy X get Y, buy A get B, free gifts over a spend amount and tiered cart goals, and there’s a free plan to try it. Setup takes a few minutes: see Getting started.