Skip to main content

Creating A Gift With Purchase Offer

In this guide we show you how to create a free gift with purchase workflow using a Rebuy Gift With Purchase widget.

Written by Christian Sokolowski

There are key benefits to using Gift With Purchase (GWP) offers in your sales strategy. First, GWP offers inspire brand loyalty when word spreads about your free gifts. Second, you can use GWP offers to manage your inventory (buy X get Y). Finally, GWP inspires your customers to spend more which increases your AOV.

Rebuy's free gifts functionality allows businesses to align promotional strategies with rules based on cart value, products, or combinations. It becomes even more effective when combined with Rebuy's Smart Cart V2.

With the Gift With Purchase (GWP) widget, Rebuy makes it easy to create GWP campaigns that help you boost sales on BFCM and beyond. For example, when a GWP offer is accepted Rebuy automatically adds the gift to the cart for instant satisfaction. Because your customer doesn't have to search around to add the gift item themselves, you save them time.

NOTE: The Gift With Purchase Widget doesn't show items offered, as it simply handles the automatic adding of the free gift to the customer's cart when specific conditions are met. There is no interface for the customer to interact with.

If you wish to show a visual component for your free gift promotion, consider using the Smart Cart's Tiered Progress Bar to offer a free gift:


Installation Instructions

Step 1: Create a New Gift With Purchase Widget

Create a new widget as shown below in Rebuy Admin.

Step 2: Configure the Widget's Data Source

In the General setting of the widget editor you will see Data Source. Click the "edit" link to open the connected Data Source Rule Builder that has been created for this widget.

An example of how this is used is saying: IF Cart Subtotal is GREATER THAN X amount of $ RETURN Free Item. You can also say IF Cart Subtotal is GREATER THAN X amount of $ AND/OR Products/Collections CONTAINS/ CONTAINS ANY (etc) RETURN Free Item. When setting up conditions for free gifts, be cautious with OR statements. Ensure each "OR" block includes all applicable conditions such as cart subtotal. For example, use "Cart Subtotal >= $50 OR Cart Subtotal >= $100" rather than "Country = US OR Cart Subtotal >= $50" which can create ambiguous configurations. For product-specific inclusions, "Products Contains Any" is recommended over "If Product Equals" as it ensures the free gift adds regardless of whether the specific product is the sole item or part of a larger cart.

NOTE: GWP widgets are not compatible with Subscription products.

Only one-time purchase variants can be selected and returned using the GWP widget's Data Source rules. However, subscription products can still be used as the input (trigger) product.

Step 3: Enable the Gift's Product Discount using Shopify Functions

Rebuy now supports product discounting using Shopify Functions directly within the GWP widget's settings. To enable the discounting of products both in the widget and throughout the customer's cart and checkout experience, simply toggle on the "Use Shopify Functions (Recommended)" option below and input the specific discount you are looking to apply to the gift product(s) offered via the GWP widget. You can configure a "Fixed" discount, or "Percentage" based discount using this feature.

For more information on how discounting works with Shopify Functions via Rebuy, please refer to our Rebuy Discounting Overview guide linked below.

NOTE: If you only want to show a "visual" discount (i.e., Rebuy will display the discount in the widget, but will not apply the discount once the products are added to the cart), toggle off the Shopify Functions setting.

Step 4: Install the Gift With Purchase widget (GWP) to your Shopify Online Store

To install the widget, click the Install link located in the top right of the widget editor header. A new window will open with specific instructions for you to follow to complete the install process. These instructions may include copying and pasting code, configuring settings, or other steps. It is important to follow these instructions carefully to ensure a successful installation.

'Live Mode' is turned ON by default when you create a Gift With Purchase widget. So before you finish installing it in your Shopify theme editor, if you want to test the widget without customers seeing it, be sure to toggle Live Mode OFF first.

Need more help?


Additional Settings

Since there is no visual aspect to the Gift With Purchase Widget, no editing of the layout is required.

Gifts Without Purchase

We've recently updated the Gift With Purchase (GWP) widget settings, impacting how gifts are managed in carts:

  • Default to enabled for all pre-existing GWP widgets: By default, all existing GWP widgets will allow adding gifts to an empty cart.

  • Default to disabled for all future GWP widgets: By default, newly created GWP widgets will not add gifts when the cart is empty, and will automatically remove any gifts if they are the only remaining items in the cart

This update aims to prevent situations where free gifts remain in the cart after all paid products have been removed!

To adjust these settings, navigate to:

Gift With Purchase Widget's Settings -> General Tab -> GIFTS WITHOUT PURCHASE.

Quantity Selectors

The widget allows the option to hide the quantity selectors on all items added from this widget. This requires the use of Rebuy Smart Cart also, the quantity selectors will not be hidden in theme carts.

To adjust this settings, navigate to:

Gift With Purchase Widget's Settings -> General Tab -> Quantity Selectors


Best Practices

Optimizing Free Gift Performance

  • Transition from legacy systems to Smart Cart V2 for enhanced feature compatibility.

  • Use Shopify Functions for creating customized discounts and advanced logic.

  • Regularly evaluate and update your data source and rules to adapt to dynamic business requirements.

  • Always double-check compatibility settings in Shopify when combining discounts.

  • Test discounted promotions thoroughly before making them active.

  • When troubleshooting discount issues, verify both Rebuy Order Discount and Rebuy Product Discount settings in Shopify admin.

Date Scheduling using the Data Source

When editing the data source, it is best to set the time period for the specific sale. This way you don't have to lift a finger when the sale period launches.

Prevent discount caching by disabling the Discount in Rebuy Admin once your promotion has ended

To prevent discounts from being cached when a customer has added a product to their cart via a Rebuy widget (such as manually through a Product Page widget or automatically via a Gift With Purchase widget), you will need to ensure that the Shopify Functions Discount is set to "None" in the widget's settings once your promotion has ended:

Why does this happen?
Rebuy's Shopify Functions-generated discounts are attribution-based. If the product line item in the customer's cart still contains the Rebuy widget attribution data (even after the widget is disabled), the discount configured in the widget's settings will still apply.

⚠️ WARNING: Even if the Rebuy widget is disabled and set to Preview Mode in Rebuy Admin, the associated discount will remain active. Therefore, you must follow the steps above to fully disable the discount and prevent it from being applied.


Important Considerations

Disclaimer: Shopify's cart cookie persists items in a customer's browser for up to 14 days. If a customer added a free gift to their cart before the GWP widget was disabled, the item will remain in their cart until they remove it, clear their browser cache, or the cookie expires. Disabling the widget prevents new gifts from being added but does not remove gifts already in active customer carts.

We Recommend Enabling the Storefront API!

For the best discounting experience, we highly recommend enabling the Storefront API. Here's why:

  • Accurate, Real-Time Discounting: The API ensures that discount codes are validated instantly, preventing errors and delays during checkout.

  • Support for Multiple Discounts: It allows your customers to apply multiple discounts at once, enhancing their shopping experience.

  • Improved Checkout Process: Real-time feedback helps customers know immediately if their discount code is valid, reducing confusion and improving satisfaction.

⚠️ Issue: Products Not Removed from Cart After Discount

If you're NOT using the Storefront API, you might notice that products which no longer qualify for a discount (like a free gift) are not being removed from the cart after the discount is applied. This happens because the discounting method you're using is deprecated.

To fix this issue and streamline your discounting process, we strongly recommend enabling the Storefront API. It will ensure:

  • Discounts are applied correctly in real time.

  • Products are removed from the cart when they no longer meet the discount criteria.

  • A cleaner, more robust discounting function overall.


🛠️ Alternative Workarounds

If enabling the Storefront API isn't an option, consider these workaround tactics:

  1. Flag Orders for Manual Review
    Set up a system to flag orders that don't qualify for the free gift or discount, so you can manually review and correct them later.

  2. Adjust Discount Thresholds
    Raise the discount or free gift threshold so you're comfortable with the possibility of the discount being applied in edge cases, even when it's not strictly valid.


GWP Validation at Checkout

Rebuy's Gift With Purchase (GWP) validation logic runs during the Shopify checkout process to keep free gifts honest. A background process called the GWP watcher monitors the cart at checkout, re-evaluates your GWP widget's Data Source rules, and automatically removes any gift that no longer qualifies. This prevents a customer from adding qualifying items to unlock a gift, then removing those items before paying while keeping the gift for free.

Shopify Plus only: GWP validation at checkout requires Shopify Plus. It relies on checkout extensions, which are available only on Shopify Plus plans.

How GWP Validation Works at Checkout

When a customer reaches checkout, the GWP watcher re-checks whether the cart still meets the Data Source rules for each active GWP widget, then decides whether to keep or remove the gift:

  • The gift stays when the Data Source is still valid and the gift line still carries at least one discount allocation.

  • The gift is removed when the Data Source is no longer valid (for example, the cart subtotal dropped below the qualifying threshold), or when the gift line has no discount allocation at all — such as when a non-combinable discount code strips every discount off the line.

Removing a gift whose free status was overridden protects the customer from being charged full price for an item they expected to receive for free. Because Shopify does not let customers remove items during checkout, this automatic removal is the only way to prevent that unexpected charge.

Note: Auto-removal happens only at the checkout step itself. If a customer navigates back to the cart, the gift may still appear there. This GWP watcher logic is specific to the Gift With Purchase widget (and to checkout offer widgets with Treat as Gift With Purchase enabled) — it does not run against gifts added through the Tiered Progress Bar, which validates and removes its own gifts through separate logic in the progress bar itself.

Requirements and Limitations

For GWP validation to run at checkout, and to run correctly, the following requirements and limitations apply:

  • Shopify Plus is required. The GWP watcher runs on checkout extensions, which are exclusive to Shopify Plus.

  • At least one checkout widget must be active on the checkout page — a checkout recommendation widget, a checkout progress bar, or a checkout content block. Without an active checkout widget, the watcher does not run regardless of any other setting.

  • The gift must carry GWP widget attribution. This comes from a standard GWP widget, or from a checkout offer widget with Treat as Gift With Purchase enabled (a Checkout Extensions setting — see the next section).

  • The Data Source must return specific products. An AI-recommended endpoint does not return a fixed product, so the watcher treats it as invalid and removes the gift.

  • URL rules and order tag rules are not supported. These rule types are not accessible inside Shopify checkout extensions. When a Data Source uses them, validation is skipped rather than evaluated incorrectly, so the gift is not auto-removed.

  • Shopify Markets with fixed pricing can misfire. When products use fixed market prices, the watcher can incorrectly remove gifts for customers shopping in a non-default currency. See the edge case below.

  • A partial discount is not detected. The watcher only checks whether the gift line has any discount allocation at all — it does not check whether that discount fully zeroes out the price, and it does not check whether the discount actually came from Rebuy. If the intended 100%-off discount is misconfigured, or is replaced by a different discount that still leaves some (but not all) of the price discounted, the gift line still has a discount allocation and is not auto-removed — the customer can end up paying a partial price for what should be a free gift. Verify in a test checkout that gift lines actually reach $0 rather than assuming the watcher will catch a partially-discounted gift.

Edge Case: Shopify Markets + Fixed Pricing

When your store uses Shopify Markets with fixed market prices (rather than dynamic currency conversion), the GWP watcher may incorrectly remove gifts at checkout for customers shopping in a non-default currency. This happens because Shopify does not expose currency conversion rates at checkout, so the watcher's threshold calculation uses the wrong value.

Problem Scenario (Different Currency + Fixed Pricing)

  • Setup: Shop default currency USD, GWP threshold $10 USD, customer switches to GBP, Shopify currency rate ~0.755 (converted threshold: £7.55)

  • Product A: USD price $8, GBP price £8 ⚠️ (fixed market pricing — not dynamically converted)

  • In Cart: GWP calculation uses 8 × (1 / 0.755) = $10.59 → threshold met → 🎁 GWP is added

  • At Checkout: Watcher references checkout subtotal (fixed £8) → subtotal appears below threshold → GWP watcher removes the gift ❌

Workaround: If your store uses Shopify Markets with fixed pricing across multiple currencies, test your GWP threshold behavior in each currency where you have fixed prices. Consider setting thresholds that account for this discrepancy, or use dynamic (non-fixed) pricing where GWP promotions are active.


FAQs

What should I do if the GWP item flashes repeatedly when it is added to the cart?

This issue typically arises due to a rule configuration using "Product equals" instead of "contains any." Update the data source configuration to use "contains any" for stable functionality.

Why isn't the GWP being added to the cart?

Ensure that the GWP product is active, published, and properly configured in Shopify. Inactive or unpublished products will not be added to the cart.

Why doesn't the selectable GWP widget popup appear in the Smart Cart?

This may be due to the widget not being properly installed. Check the installation step in the widget settings to confirm the setup is complete.

Do I need to be on a Shopify Plus plan to use the GWP widget?

No, a Shopify Plus plan is NOT required, as you can use Shopify Functions directly within the Widget's settings to enable a product discount for the free gift. The Shopify Functions discounting feature in the Widget settings is now available to all Shopify plans.

Is it possible to automatically add a free product to cart after a customer has entered a discount code?

A discount code can trigger a Gift With Purchase (GWP) in Rebuy by pairing a GWP widget with the IF Discount Code Rule. Set the IF rule to Discount Code, choose Equals or Contains, enter the code, and set the RETURN to a Specific Product. When the shopper applies the code in the Smart Cart discount field, the rule fires and the gift is added to the cart. The code must be valid in Shopify independently of the gift, so it cannot be a Buy X Get Y code scoped to the gift product, because that code will not validate until the gift is already in the cart. The rule reads only manually entered codes, and it is not supported on Post Purchase Offer widgets. For the full rule reference, see Discount Codes as a Condition Input for Data Sources.

Why are products not being removed from the cart after discounts are applied?

This is typically caused by not using the Storefront API. The deprecated discounting method doesn't automatically remove products from the cart when they no longer qualify for the discount (e.g., a free gift). To resolve this, enable the Storefront API for real-time discount validation and automatic cart adjustment.

Can I use both the Tiered Progress Bar and Gift with Purchase widget together?

While technically possible, using both tools simultaneously for the same promotion can lead to conflicts such as duplicate gifts being added to a customer's cart. For best results, choose the tool that best aligns with your promotional strategy and disable the other for that specific promotion.

Are Subscription products supported for GWP?

At this time, Subscription products are not supported for GWP.

How do I setup a Selectable GWP widget?

The "Selectable Gift With Purchase" widget is not a standard Rebuy widget (it is a customized version of a Cart Cross-sell widget), therefore additional custom code is required to ensure proper functionality. Refer to our on guide on custom implementation for this widget type: Selectable Gift-With-Purchase Widgets

Why is my GWP widget that is set to return a BOGO offer continuously looping in my Smart Cart?

If the INPUT product is the same as the OUTPUT product for your GWP Data Source (for a Buy One, Get One promotion), your "IF" statement must use a "Product" -> "Contains Any" rule. Although this is a cart-based workflow, a product specific rule is required in this scenario.

Why is my GWP widget's Data Source INPUT product tag rule not working properly when adding the tagged product to cart?

If you wish to have the GWP widget triggered when a specific tagged product is added to cart, your Data Source rule's IF statement must use a "Contains Any" INPUT statement. Although this is a cart-based workflow, a product specific rule is required in this scenario.

Why is my GWP widget still providing the free gift after disabling it?

Once the GWP widget is disabled no new customers will receive any gifts from that widget. However there may be customers who already had a gift added to their cart prior to the widget being disabled. Those items will not be removed from their cart when the widget is disabled.

Example: Customer A correctly receives a GWP item at 12:00pm. The widget is disabled at 12:05pm. Customer B begins shopping at 12:07pm and would not receive any items from the widget. Customer A would keep the item they received unless they manually remove it. This means it is expected that you may see orders containing items from disabled widgets. It is from shoppers that already had the item prior to the widget being disabled and are completing their checkout. The orders are not from new customers continuing to access the disabled widget.

Why is my free gift being added to the cart but still charging the customer?

This typically occurs when the Shopify Functions setting in your widget is not properly toggled on. Navigate to your widget settings and ensure Shopify Functions is enabled to apply the discount automatically.

Why aren't my free gift eligibility rules working correctly?

Revisit your data source rules and ensure all cart conditions are properly set under each logical "OR" or "AND" statement. Adding a cart subtotal condition into every OR block often resolves conflicting setups that may prevent free gifts from being applied correctly.

I'm using a URL Contains rule in my GWP widget's Data Source, but the free gift disappears from the Smart Cart when I navigate to another page/URL on my storefront. How do I ensure the gift always remains in cart?

For this scenario, we recommend using an Advanced UTM rule by following the steps in following guide: URL/UTM Based Rules

Essentially, you will need to ensure there is a specific UTM that can be keyed off of for your particular GWP campaign. For example, if you use a URL Contains rule that starts with utm_source= , utm_medium= , utm_campaign=, utm_content= it should work as expected, and the GWP won't disappear when the customer navigates away to a different page on the site.

Will the GWP validation logic run during checkout?

Yes, Rebuy's GWP validation logic can run during the Shopify checkout process to monitor cart conditions and automatically remove gifts if a customer no longer qualifies. This feature is available on Shopify Plus only and requires at least one active checkout widget on the checkout page. For full details on requirements, limitations, and how auto-removal works, see the GWP Validation at Checkout section above.

Can I use a checkout offer widget as a Gift With Purchase widget?

Checkout offer (recommendation) widgets include a Treat as Gift With Purchase setting in their Advanced Settings tab. When enabled, the GWP watcher validates that widget's items exactly as it would a standard GWP widget — removing the gift if cart conditions are no longer met. This requires both Enable Attribution Tracking and Enable Widget Tracking to be on — without Widget Tracking, the watcher cannot identify the item and will not validate or remove it — and is available to Shopify Plus merchants. For full setup steps, see Checkout Extensions Installation and Settings.

Does Rebuy automatically remove GWP products at checkout when a discount code overrides their free status?

Rebuy automatically removes a GWP product at checkout when a discount code, an automatic discount, or any other discount that isn't combinable with the gift's discount causes that GWP item to lose its free status — but only when the GWP watcher's own requirements are met. This runs through the same GWP watcher logic described in the GWP Validation at Checkout section, and it has the same requirements: Shopify Plus and at least one active checkout widget.

If those requirements are not met, the GWP watcher does not run, so the gift item itself is not automatically removed — but its discount is still lost, since discount combinability is controlled by your store's discount configuration rather than by the GWP watcher. In that case, the customer keeps the gift item in their cart, but they are charged full price for it.

Did this answer your question?