GWP with "discount code" - Anyone figured it out?

Topic summary

A merchant on the Basic Shopify plan wants to automatically add a free gift product to the cart when customers enter a discount code after reaching a spending threshold—without requiring manual addition by the customer.

Core Challenge:

  • Shopify’s native discount system cannot automatically add products to carts
  • Checkout customization (via Script Editor, Functions, or Checkout UI Extensions) requires Shopify Plus
  • No app or workaround exists for Basic plan users to achieve this at checkout

Proposed Workarounds:

  • JavaScript solution: A code snippet was shared that detects discount codes and auto-adds products to the cart page (not checkout). This requires combining it with a separate product discount to make the gift free
  • Shopify Plus options: Apps like Dollarlabs Ultimate Discounts and BOGOS offer checkout-level solutions using Checkout UI Extensions, but only for Plus merchants

Status:

  • The discussion remains unresolved for Basic plan users
  • The original poster has not confirmed whether they found a working solution or upgraded to Plus
Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

Hi everyone,

I’m trying to run a promo where customers who spend XX € or more can enter a discount code (e.g. FREEGIFTXX) and automatically receive a specific product for €0without needing to add the gift to the cart themselves.

The built‑in Buy X Get Y discount works, but only after the customer manually adds the gift to the cart—too much friction.

My setup: Basic Shopify plan (no Shopify Plus → no Script Editor / Functions).

What I’ve tried

  1. Searched the App Store for “free gift” and “buy X get Y” apps.

  2. Found a few options, but none of them offers what I need.

What I’m looking for

  • Any app (free or paid) that lets me:

    • set a cart‑value threshold,

    • let customers enter a code,

    • have the gift auto‑inserted at 100 % off.

  • OR a reliable liquid/JS workaround that doesn’t require Plus.

If you have this working—or know an app that ticks all the boxes—I’d love to hear your recommendations.

Thanks a lot for your help!

Andraz R.

5 Likes

Hi Andraz,

So, here’s the thing:

  • Discounts in Shopify can ONLY reduce prices of products/the order subtotal/delivery methods. They can’t do additional things, such as adding items to the cart.
  • In addition, in the checkout, where discount codes are entered, you can’t add custom code unless you’re on Shopify Plus. Creating custom apps based on Shopify Functions, or using the Checkout UI Extension API is only for Plus.

So, there’s no way for you to achieve this without Plus.

Best,

Tobe

Andraz,

Lesle this side from Dollarlabs Ultimate Discounts - what you’re looking for is achievable on Plus through a combination of Checkout UI extension + Discount functions to ensure that this experience works for the user at the checkout screen.

If that’s not a huge concern however, you can have a simple JS script add the free product to cart when the cart has a discount code applied on it. Note that this will fail to execute on checkout.

Here’s a sample snippet that gets you started on the right track without using any app.

document.addEventListener('DOMContentLoaded', function () {
  const TARGET_DISCOUNT_CODE = 'TESTODD'; // The discount code to look for
  const BONUS_VARIANT_ID = 44576722157771; // Replace with your bonus product's variant ID
  const BONUS_PRODUCT_QUANTITY = 1;

  // Helper to check if bonus product is already in cart
  function isBonusInCart(cartItems) {
    return cartItems.some(item => item.variant_id === BONUS_VARIANT_ID);
  }

  // Add bonus product to cart
  function addBonusProduct() {
    fetch('/cart/add.js', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ id: BONUS_VARIANT_ID, quantity: BONUS_PRODUCT_QUANTITY })
    })
    .then(res => res.json())
    .then(data => {
      console.log('Bonus product added to cart:', data);
      sessionStorage.setItem('bonus_added', 'true');
      location.reload(); // Refresh cart to reflect update (optional)
    })
    .catch(err => console.error('Error adding bonus product:', err));
  }

  // Main logic
  fetch('/cart.js')
    .then(res => res.json())
    .then(cart => {
      const appliedDiscounts = cart.cart_level_discount_applications.map(d => d.title.toUpperCase());
      const bonusAlreadyAdded = isBonusInCart(cart.items);

      if (appliedDiscounts.includes(TARGET_DISCOUNT_CODE) && !bonusAlreadyAdded && !sessionStorage.getItem('bonus_added')) {
        addBonusProduct();
      }
    })
    .catch(err => console.error('Error fetching cart:', err));
});

Note that this doesn’t apply a discount to the product itself, it only checks for a cart level discount and adds a product to the cart. You can also setup a product discount on our app to ensure that it only gives 1 unit of free product when the conditions are matched.

Hope this is a good enough workaround, but with limitations due to what Shopify offers on their non plus plans. If you found my answer helpful - please mark it as a solution so that others can also find value.

Hi @ZAAZ89

I’m afraid to say that automatically adding a free gift after entering a discount code at checkout isn’t possible on a Basic Shopify plan (no way to dot this if not Shopify Plus).

If you are on Shopify Plus, BOGOS can make this work smoothly with its Checkout Upsell feature

If you’re not on Plus, I still recommend using a powerful gift app like BOGOS to automatically add free gift to cart—it’s currently the best way to enhance the customer experience!

** :glowing_star: Why not try it yourself**when you get a 7-free day trials of BOGOS (4,9 ratings, 2k7+ reviews)?

@ZAAZ89

Since quite some time has passed since you raised this thread, I’m assuming you’ve already reached at a solution :slightly_smiling_face:

If so - can you please share the same and close this thread out so that others who stumble here might also find value.

Best,

Hi @ZAAZ89 :waving_hand:

You’re right that Shopify’s native Buy X Get Y has a limitation, the customer must manually add the free gift to the cart, which creates friction.

I’d suggest you try Monk from the Shopify App Store. I’m part of the Monk team, and I can confirm it covers all three of your requirements:

  • Lets you create a threshold based on the cart value, item count, a product from a specific collection etc.
  • Lets the buyer use a discount code
  • Adds the gift item(s) automatically to the cart and can show the gift as 100% off

Monk automatically adds the free gift to the customer’s cart when the conditions are met, in your case, when the cart value crosses your threshold and the discount code (like FREEGIFTXX) is applied.

Everything is fully customizable to match your brand’s style, and Monk integrates directly with your existing cart, so there’s no need to modify your theme or write any code. Our support team is available 24/5 and can help with any custom fixes if needed.