Using a code to add a free gift to cart

Topic summary

Main issue: apply a discount code that automatically adds a free product to the cart. Shopify’s native discounts can only adjust prices; they cannot add new line items, so this isn’t supported out of the box.

Workarounds suggested:

  • Use a “free gift with purchase” or “auto add to cart” app from the Shopify App Store.
  • On Shopify Plus, build a custom app using Checkout UI extensions to detect an applied discount, add the gift item, and tag it (via a metafield or line-item property) to prevent duplicates. (Checkout UI extensions = customizations at checkout; metafield/line-item property = custom fields attached to items.)

App recommendation: BOGOS: Free Gift Bundle Upsell.

  • Option 1: Automatically add the free gift when conditions (e.g., BOGO, Buy X Get Y, spend thresholds) are met—no discount code needed.
  • Option 2 (Shopify Plus only): Use a discount code at checkout together with a BOGOS Checkout Upsell offer and enable “Discount code required.”

Images are provided to illustrate configuration steps and conditions. Status: no final resolution yet; the original poster plans to try an app and report back.

Summarized with AI on December 10. AI used: gpt-5.

Hello all! I’m trying to create a discount code where once it’s added, a free product is added to the cart. Right now on Shopify this is not possible - we have to add the product first and then use the code. This adds some friction which is not ideal.

Any workaround available for this? Or any free app that’s able to do the job?

Thanks!

1 Like

Hi DylanJudi,

In Shopify, discounts are only capable of calculating price reductions on items. They can’t affect the cart in other ways, such as adding new line items.

You might want to search for an “auto add to cart” or “free gift with purchase” app in the Shopify App Store.

Alternatively, if you’re on Shopify Plus, you might consider building a Checkout UI extensions custom app that:

  • Checks which discounts have been applied to the cart
  • If the desired discount has been applied, add the desired item to the cart
  • Add a special metafield or line-item property to the item you added, so that you can prevent automatically adding it again

Best,

Tobe

Thanks Tobe! Thought so, will give look for an app and give an update here on what works in case someone has the same problem.

Hi @DylanJudi

If you still haven’t found a solution, I’d like to suggest trying the BOGOS: Free Gift Bundle Upsell app. You can set it up exactly the way you described. Here are two options:

Option 1: Auto-add free products to the cart (no discount code needed)
When shoppers meet your conditions (BOGO, Buy X Get Y, Spend More Get More, etc.), the free gift will be automatically added to the cart. You can also apply additional conditions as shown in the image.

Option 2: Use a discount code at checkout to get a free product
(Available for Shopify Plus stores only)

First, create a discount code in Shopify’s native discount settings.

Next, set up a Checkout Upsell offer in the BOGOS app and fill in the details as shown in the image.

Finally, tick the “Discount code required” option so the offer can work together with Shopify’s native discount code.