Skip to main content
All CollectionsDiscountingGift with Purchase
How To Create A GWP Shopify Script
How To Create A GWP Shopify Script

In this guide we will learn how to create a Gift With Purchase Shopify Script using a script creator

Strauss Van Wagenen avatar
Written by Strauss Van Wagenen
Updated over a week ago

Note: Shopify Plus is required to make use of Shopify Scripts.

Shopify Plus is required to make use of Shopify Scripts. As of February 13, 2023 Shopify announced that Shopify Scripts will be deprecated on August 28, 2025 and they will be moving to functions. They have since removed the Script Editor application from the Shopify app store.

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 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!

Did this answer your question?