How to Automatically Apply a Discount/Coupon Code

Updated on 22nd June 2023 in Marketing


In this tutorial, we will guide sellers on how to automatically apply a discount or coupon code in by appending it to their store URL or using the Shoprocket.js SDK. This feature allows customers to access discounted prices or special offers effortlessly. Let's get started!

Option 1: Appending the Coupon Code to the Store URL

Step 1: Obtain the Coupon Code:

First, obtain the coupon code that you want to apply automatically. It should be a unique code associated with a specific discount or offer.

Step 2: Access your Store URL:

Locate the URL of your store. This URL typically looks like: for hosted stores, and will be your own domain name when using our embeds.

Step 3: Append the Coupon Code:

Append the coupon code to the store URL using the following format:!/coupon=YOUR_COUPON_CODE

Replace YOUR_COUPON_CODE with the actual coupon code you want to apply. For example:!/coupon=JIVCGV2C


Step 4: Share the Modified URL:

Share the modified store URL with your customers. When they access the URL, the specified coupon code will be automatically applied to their purchases.

Option 2: Using the Shoprocket.js SDK

Step 1: Add Shoprocket.js to Your Website:

Ensure that the Shoprocket.js SDK is included on your website. This is included automatically when using our embeds.

Step 2: Apply the Coupon Code:

To automatically apply a coupon code using Shoprocket.js, use the following javascript code snippet:


Replace YOUR_COUPON_CODE with the actual coupon code you want to apply, and ensure it's included in a .js file or inside tags if added directly to your view.

You should also ensure that any usage of our SDK is performed after Shoprocket is fully loaded, you can do that by listening for the "Shoprocket.ready" event, like this:

Can’t find what you’re looking for?

Chat with us 👋

or contact us on [email protected]

as featured in