For merchants who are still using legacy Shopify Scripts for a Rebuy Gift With Purchase widget, this guide will provide an overview of how to create a Gift With Purchase Shopify Script using a script creator.
NOTE: Shopify Scripts for discounting is only compatible with Shopify Plus and available to merchants who were previously granted access to the Script Editor app in Shopify Admin. Shopify has since removed the Script Editor app from the Shopify App Store for new merchants.
Because Shopify Scripts will be deprecated by Shopify in August 2025, it is highly recommended to migrate over to using Rebuy's discounting feature using Shopify Functions.
For more information on how to use Rebuy's integration with Shopify Functions for discounting, please refer to our Rebuy Discount Overview guide linked below.
Shopify Scripts is not a Rebuy product, and unfortunately, Rebuy Support is unable to create, modify, or customize Scripts to align with your specific needs.
We recommend using our guides as a helpful reference for any Script customizations you'd like to implement. If you encounter challenges with your custom scripts, we suggest reaching out to Shopify support for assistance. For additional details on our support scope, please consult our policy page. Your understanding is greatly appreciated.
Building a Gift With Purchase has two major steps:
Creating a GWP widget
Creating a discounting script
Creating a GWP widget:
For creating a GWP widget, please reference our help doc on how to do this.
Creating a discounting script:
Navigate to https://jgodson.github.io/shopify-script-creator/ and click "Create new" and then "Conditional Discount":
Make sure that the "Discounted Item Selector" is set to "Has Properties":
In the keys and values section, add "_widget_id" as the key and the ID of the widget you would like to discount as the value. Add the discount you'd like to apply (our free gift with purchase example is 100% discounted), and click save:
Generate the script and copy it to your clipboard:
Navigate to Shopify Script Editor App in Shopify:
Create a new Blank Template Script and paste in the Script you just copied, and be sure to preview it in your store to test it out:
Test out your widget and see if the discount was applied:
Congratulations, you've now successfully created a Gift With Purchase widget and applied the discount using a Shopify Script!