Last updated: August 2026

An influencer posts "use code SARAH20 for a free tote with any order." Customers type the code in at checkout, get their percentage off — and no tote shows up. Support tickets start rolling in asking where the free gift went, and the influencer partnership that was supposed to drive goodwill instead drives complaints.

This is a narrower version of a problem every Shopify merchant running gift-with-purchase promotions eventually hits: Shopify's discount engine can apply a code, but it can't put a product in the cart on its own. When the trigger is a specific promo code — an influencer's unique code, a welcome-flow discount from an email sequence, a loyalty reward code — that gap matters even more, because the whole appeal of the offer is that it should feel automatic the moment the code is entered.

This guide covers what Shopify's native discount codes can and can't do for a code-triggered free gift, and three ways to close the gap: a manual workaround, a custom Shopify Functions build, and a rule-based app. If you only need the code itself to apply without typing, follow our two native ways to auto apply a discount code on Shopify before adding gift logic.

What a Shopify promo code can and can't do for a free gift

Shopify discount codes are powerful for price changes — percentage off, fixed amount off, free shipping, or a Buy X Get Y structure that makes a specific product free or discounted. What they can't do, natively, is add a product to the cart that isn't already there. The "get" side of a Buy X Get Y discount, code-based or automatic, only ever discounts an item the customer has already placed in their cart — it never inserts one.

So when an influencer's code is supposed to "unlock" a tote, or a welcome-series email code is supposed to add a sample product, the code alone doesn't do that job. Something else has to put the gift in the cart once the code is detected. That's true whether the code is driving one-off influencer gifting, an automated email flow, or a tiered loyalty program — the underlying mechanic is the same, only the source of the code changes.

Method 1: Native discount code + Buy X Get Y (free, but two things have to happen)

This is the no-app option, and like the general gift-with-purchase workaround, it works — with a real catch. You create the gift product, then build a code-based Buy X Get Y discount instead of an automatic one.

Setup steps:

  1. In Shopify admin, go to Products and create the gift item (e.g., "Free Tote — SARAH20 Gift").
  2. Go to Discounts and create a new discount, type Buy X, get Y.
  3. Under Discount type, choose Discount code (not automatic) and set the code to match what you're distributing — e.g., `SARAH20`.
  4. Set Customer buys to a minimum purchase amount (often $0, or $1, so any order qualifies) and Customer gets to the gift product at 100% off.
  5. Set a usage limit if the code is meant for a single influencer's audience, not the general public, and save.

The problem: entering the code only makes the gift product free if the customer has already added it to their cart — and most customers who type in an influencer's code have no idea they need to go find a specific SKU and add it manually before that discount does anything. The offer reads as "use this code for a free gift," but the actual mechanics require a second, unrelated action the customer was never told about.

Method 2: Shopify Functions triggered by the applied code (requires a developer and Plus)

Shopify Functions can read what's happening in the cart, including which discount is applied, and add a line item programmatically in response. That solves the auto-add problem — but cart and checkout customization through Functions is a Shopify Plus feature, and building one means writing and deploying custom code (typically Rust or JS/WASM) through the Shopify CLI.

What this involves, at a high level:

  1. Map each promo code (or code pattern) to the gift product it should trigger, with a developer.
  2. Build a function that reads the applied discount/code on the cart and adds the corresponding gift line item.
  3. Deploy and configure it through a companion admin extension, then test every code-to-gift mapping.
  4. Maintain it as codes rotate — a new influencer code means a code change in the function's mapping logic, not just a new discount in admin.

This is the right call if you're running many simultaneous, differently-configured promo codes (say, a roster of creators each with a unique code and a unique gift) and already have Shopify Plus and dev resources. For a single campaign or a small set of codes, it's a lot of engineering overhead for something a rule-based app already handles.

Method 3: A rule-based app with a promo-code trigger (no code, no Plus)

The middle path is the same one that works for cart-value or product-based gift-with-purchase offers: a rule engine that watches for a condition and auto-adds the gift the moment it's met — except here, the condition is "this promo code was applied" instead of a cart total. Apps like AutoCart support this as a trigger type alongside cart-value and product-based rules, so influencer codes, email-flow codes, and loyalty reward codes can all unlock a gift without a developer touching checkout code.

Setup steps using AutoCart:

  1. Install AutoCart from the Shopify App Store and open the app dashboard.
  2. Create a new rule and set the trigger condition to a specific discount/promo code (or a set of codes, if several creators or flows share the same gift).
  3. Set the offer type to free gift and choose which product gets added.
  4. Set the cart message so the customer sees why the item appeared — e.g., "SARAH20 applied — your free tote is in your cart."
  5. Decide whether the customer can remove the gift, and save the rule.

Once live, entering the code and adding the gift happen as one motion from the customer's side — no separate product search, no confusion about whether the offer "worked." And if the code is removed from the cart before checkout, the rule can remove the gift with it, so nobody reaches checkout holding a free item tied to a promo they backed out of. That same removal logic is what keeps BOGO offers from leaking margin when a qualifying item gets taken out of the cart.

Which promo-code gift method should you use?

Native discount code Shopify Functions Rule-based app
Auto-adds the gift when the code is entered No — customer must add it too Yes Yes
Requires Shopify Plus No Yes No
Requires a developer No Yes No
Handles multiple codes → different gifts Manually, one discount per code Yes, in the function's logic Yes, one rule per code
Setup time Minutes Days to weeks Minutes
Auto-removes gift if code is removed No Depends on build Yes

If you're testing a single small-scale code with a friendly audience, the native workaround costs nothing but expect some customers to miss the manual step. If you're running a large roster of creator codes with bespoke logic and you're already on Plus, Functions gives full control. For most merchants running influencer, email-flow, or loyalty promo codes, a rule-based app gets the auto-add behavior live in minutes without the Plus requirement.

Common mistakes when tying a free gift to a promo code

  • Using one shared code for multiple influencer campaigns. If every creator's audience gets the same code, you lose the ability to see which partnership actually drove orders — and you can't turn off one creator's gift without turning off all of them.
  • Not setting a usage limit. A code posted publicly by an influencer can spread past their audience fast. Cap redemptions or set a per-customer limit so a "gift for my followers" offer doesn't quietly become an unlimited giveaway.
  • Forgetting to expire the rule with the campaign. A promo code tied to a time-boxed partnership or seasonal email flow should stop granting the gift when the campaign ends — leaving it live after the fact erodes margin for no marketing benefit.
  • Not testing the removal case. If a customer applies the code, gets the gift, then removes the code before checkout, verify what happens to the gift. An orphaned free item that survives a removed discount code is a margin leak, and the native discount method won't clean this up for you.
  • Mismatched messaging. If the influencer's caption says "free gift with code X" but the cart doesn't explain why the item appeared, customers sometimes assume it's an error and remove it themselves.

Free gift with a promo code: frequently asked questions

Can a Shopify discount code automatically add a free gift to the cart? Not on its own. A Buy X Get Y discount code can make a product free, but only after the customer has already added that product to their cart. To have the gift appear the moment the code is entered, you need either a custom Shopify Functions build (Plus required) or a rule-based app that triggers on the applied code.

Do I need Shopify Plus to give customers a free gift with a promo code? No. You only need Shopify Plus if you're building the auto-add logic yourself through Shopify Functions. The native discount-code workaround and rule-based apps both work on standard Shopify plans.

How do I give an influencer a unique code that unlocks a free gift? Create a discount code specific to that influencer (with a usage limit if it's meant for their audience only), then set a rule-based app to auto-add the gift product whenever that code is applied to the cart — no manual product-add step for the customer.

What happens to the free gift if the customer removes the promo code? With the native discount-code method, nothing removes the gift automatically once it's been added — it can reach checkout even after the code is gone. A rule-based app like AutoCart can remove the gift the moment the triggering code is no longer applied, protecting your margin.

Make the code do what your marketing already promised

If a promo code is doing the work of announcing a free gift — in an influencer's caption, a welcome email, or a loyalty program message — the checkout experience needs to match that promise the moment the code is entered. That's a harder bar to clear than a standard cart-value gift-with-purchase offer, because the customer already believes the gift is coming and any extra friction reads as a broken promise.

AutoCart handles the promo-code trigger, the free-gift add, and the automatic cleanup if the code is removed, all in one rule; no theme edits, no developer, no Shopify Plus. If you're building out a broader gift-with-purchase program beyond code-triggered gifts, the full gift-with-purchase setup guide covers cart-value and product-based triggers too. And if you're running a separate cart-value gift alongside an unrelated discount code — not a code that triggers the gift itself — see our guide to combining a free gift with a discount code on Shopify for the platform stacking limits and why the two can silently conflict.

Try AutoCart free on your Shopify store: apps.shopify.com/autocart-auto-add-to-cart