This guide walks you through how to create a Gift With Purchase (GWP) Shopify Script using a third-party script creator. It's intended for merchants still using legacy Shopify Scripts to power GWP experiences with Rebuy.
⚠️ Important Notes:
Shopify Scripts are only available to Shopify Plus merchants who were previously granted access to the Script Editor app.
The Script Editor app is no longer available to new merchants, and Shopify Scripts will be deprecated in August 2025.
For future-proofing, we strongly recommend migrating to Rebuy Discounting with Shopify Functions.
🚨 Before You Begin
Rebuy does not create or customize Shopify Scripts.
We provide this guide as a reference. For custom script support, please contact Shopify Support.Learn more about what Rebuy Support can help with on our Support Scope Policy page.
GWP Setup Overview
Creating a Gift With Purchase requires two main steps:
1. Create a GWP Widget
To create the widget that triggers the free gift, follow this guide:
👉 How to Create a GWP Widget
2. Create a Discounting Script
To apply the discount via Shopify Scripts:
Step 1: Use the Shopify Script Creator Tool
Visit Shopify Script Creator.
Click Create new, then select Conditional Discount.
Step 2: Configure Your Script
Set the Discounted Item Selector to:
Has Properties
In the Keys and Values section:
Key:
_widget_id
Value: (Enter the ID of the widget you want to discount)
Choose your discount (for example, set it to 100% for a free gift).
Click Save.
💡 If you’re unsure where to find your widget ID, it’s available in your Rebuy Admin under the widget settings.
Step 3: Add the Script to Shopify
Copy the generated script to your clipboard.
Open the Shopify Script Editor in your Shopify Admin.
Create a new Blank Template.
Paste the copied script.
Preview and test it in your store to confirm it works.
✅ Test and Confirm
Add a qualifying item to your cart to trigger the GWP.
Make sure the correct item is added and discounted as expected.
You're All Set!
If everything works as expected, congrats—you’ve successfully created a GWP using a Shopify Script and a Rebuy widget! 🎉
What's Next?
As Shopify moves away from legacy Scripts, we encourage merchants to explore the Rebuy Discounting feature built on Shopify Functions, which offers more flexibility and long-term support.