How to use Shopify Scripts to create a gift with purchase (GWP)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf22c_Group%201000004243.webp)
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.
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/66577c3b246ca702218cf466_62977b383064e03f1c41c68b_nyeOCbvHA0xq1IP1fP4fIztcp5SvQJ1xZIRGQjvPwy6GE2QzI54YTM10ueCclnCjYiidWrBnUQ6yizvsMVx02KXbvOjTgNCZEE02Vxt4tKkfMyC55iBJeFVE-3iRWMdXtEvaf8CreaupisWxhA.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/665f3e383b5c5a70a44d6b16_62f11c50150fefe104f133b7_Screen%2520Shot%25202022-06-01%2520at%252010.12.51%2520AM.png)
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
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/66577c3b246ca702218cf46d_62977b38241c5149dbd527ef_EoFoXgYQFVvui_ws71QQEEU_vs1_4lELtST5ZyRgi3U2SBR31fXn_SCBjOsrzkzTiZkGGK3-Ck5oiYqWw0CU4_SEkV1zOAmFvQWMW85lu52wtZfb3CdBJVFVLQ2jE-kJEL-Rr3yLavIAUq2qew.png)
For the Discounted Item Selector, select Product ID
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/66577c3b246ca702218cf46b_62977b3821cd8355893322e0__yyfryJFMgU-DUL9mx6aMn22Fuj04qb5Ghc3YWoakvJE36eprcI85LC5JqmViay_VNvk3o_rIz3nqYUQQGb0RjLX8y41IBvbWPZuzr0BKt07oUdrNfdUS0xwcnmdiMAh15Kr6PiUISKu7DNX8w.png)
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
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/66577c3b246ca702218cf469_62977b383e78397f8ea85c2c_cVs8JGAIpwKsGcIa5n0joz6a7z4vnmrd4yBAWSbWis2WkYE2foxc2FsDQRcg7D_KhcKStLxfW66pZ1NQCiIr-JZbyJhulKa2uIeslZ9SLyGVqujI4mvhB1ABSedXN6WzrnaT7n8CTJ9GFUVwsA.png)
Click Save.
Generate the script and copy it to your clipboard:
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/66577c3b246ca702218cf46c_62977b386220734dde8b3fbd_eRJBPnTjeX1QCsE8fzwzMtN8YA6H-Xia29MX0jb5esRVNW9rkbvWcalokm4NpNdmdeB8W0ojP4nnbIzcAXkYpbaCrt54G3r09EPiNYZxnVVTM4ejUknVPWALUMv2YvtHYjCsxUJ9gxLeLocNYQ.png)
Great, you’re almost there! Now go to the Shopify Script Editor App in your Shopify store under Apps:
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/665f3e383b5c5a70a44d6b30_6290eadd86bdc57fda00fd8e_1gc7i3iWq-0UBA8hNv9e74c-VtJNdJR1r6RWczKqvTgWKjU3n94BgrRXsL6v-GudQCNEMcfDTVV56S4Hhq-aewIIydKPxxBu9WXJc5ObdZxllpoppjY98JEZnp29I2Vl96aTv8EAemWZNqdk4Q.png)
Create a new Percentage off a product.
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/66577c3b246ca702218cf46e_62977b3967bc636be867c467_zq6aRLFsm0EO4rshfXY93p4V-0zDx_ompeFYLd2U3zQWFg-Pq1G6FqpJpjhGWim8JKwX96S9O2h4rspEymQ3vfly5SlEmDbhW_xiXOpWGuD8tkQ9TYN3SDc3H51u5U3gWm7n_eGlwIRBW8y2BA.png)
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!
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf1bb/66577c3b246ca702218cf468_62977b3850c31f133c525c8d_ZvxDLULFDMykOKUD14Snt-XzdF9yATT6c1r4WxoYPndDb8BHedaBn_f5KGMpPfeCVLAdOctrvDfbYiejoq6W8ZZJwlOof1ySlJdHZ1EZ3ZaW_pXcQdFCw6povzN29NEkMkHqcPq0FUquYbNuqA.png)
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
Boost your sales by over 20%
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf276_Frame%201000004360.webp)
Curious how UpsellPlus can help increase AOV? Let’s talk.
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf263_cta-bgg-compressed.webp)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf264_Rectangle%20919.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf273_Rectangle%20917.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf264_Rectangle%20919.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf270_Rectangle%20913.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf273_Rectangle%20917.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf270_Rectangle%20913.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf264_Rectangle%20919.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf273_Rectangle%20917.png)
![](https://cdn.prod.website-files.com/66577c3b246ca702218cf176/66577c3b246ca702218cf264_Rectangle%20919.png)