Note: Shopify Plus is required to make use of Shopify Scripts.
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!