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

Step 3: Place the Code:

Place the code snippet at the appropriate location on your website, preferably in your website footer so it's available from every page.

Step 4: Test and Verify:

Test the implementation by navigating to the relevant page on your website and verify that the specified coupon code is automatically applied when the page loads.

Can’t find what you’re looking for?

Chat with us πŸ‘‹

or contact us on [email protected]

as featured in