How to Use Shopify Scripts to Create a Gift with Purchase (GWP)

Jaap Vergote

by

Jaap Vergote

|

June 1, 2022

You’ll need Shopify Plus to use Shopify Scripts.

We’ll create a GWP in two steps:

  • Creating a GWP upsell offer
  • Creating a script that makes it free

1/ Creating a GWP upsell offer

To create an upsell offer, install the UpsellPlus app and create your first offer. https://apps.shopify.com/upsellpluscheckout

Choose the product you want to upsell and style the widget. 

Then add the compare at price of $0 or 0%. This will make sure the price is displayed as $0.

2/ Creating a script that makes the offer free

We’ll use a script creator to do this. Go to https://jgodson.github.io/shopify-script-creator/ > Create new > Conditional Discount

For the Discounted Item Selector, select Product ID

Add the product ID of the product you’d like to offer as a GWP. Set the percentage discount to 100% and give it a message. 

This guide covers how you can find the product ID: https://www.upsellplus.com/blog-post/how-to-create-a-line-item-script-to-discount-a-specific-item-on-shopify-plus

Click Save.

Generate the script and copy it to your clipboard:

Great, you’re almost there! Now go to the Shopify Script Editor App in your Shopify store under Apps:

Create a new Percentage off a product.

Give the script a title (ex: GWP). Paste the script you just copied. Test it on your online store to see if the discount applies. If all works well, you can Save and publish!

Congrats! You just created a GWP with Shopify Scripts and UpsellPlus.

If you're looking for help with this, we offer custom script services: ShopifyScripts.com

Go to App listing← BACK to Blog