How to automatically add a discounted product to checkout via a link in Shopify

We’re going to show you how to create an automatically generated discount checkout link in Shopify.

Automatic discount checkout links can be set up very quickly and be very effective for your marketing campaigns.

This feature can be used for anything from pre-order offers, flash sales, or discount codes.

In this article, we will show you how to create automatically generated discount links and how they can be used to drive additional sales to your Shopify store.

How to add discount codes automatically to Shopify checkouts?

How can creating automatic discount links in Shopify help enhance your customers’ experience?

Entering discount codes manually can be a nuisance for customers and can even be a barrier to purchase if they are not easy enough to apply at checkout. They can be especially difficult for users to apply when using smaller devices like mobiles and tablets. 

Automatically generated discount URLs in Shopify solve this problem. They allow you to send customers directly to your store checkout without the need to enter a discount code. 

This means that you can create offers quickly for your customers and run effective, sales-driven marketing campaigns that encourage customers to use your offers.

1. How to create a discount in Shopify

Applying discounts in Shopify is very straightforward.

Shopify allows you to create instant discounts that can be applied at both store and product level.

You can choose from different product variants, quantities and discounts when setting them up so that every customer has their own tailored experience with your store. 

Adding Shopify Discount

So, how do you create a discount in Shopify?

  1. Go to “Discounts” from your Shopify admin panel
  2. Click “Discount codes”
  3. Go through and select your discount. You can choose from “percentage discounts” as “buy x get x free”
  4. Go through and adjust each setting accordingly and click save.  

A manual checkout link enables you to send your customers directly to the checkout of a particular product via a URL that is created with product variants.

If you want to generate a checkout link for a specific product, then you can do this by adding parameters to the end of your store domain.

Your checkout link needs to begin with your store’s domain, with /cart/ at the end (e.g.

You can then add your product variant ID and quantity to the end of the URL, separated by commas if you wish to add multiple products to the checkout.

Note: To find a product variant ID, click here.

A one-variant checkout link should look like this:

1.2. How to find a product variant ID in Shopify

In order to find the variant ID for a particular product, you need to follow these steps.

Find Variant ID Shopify
  1. Go to “Products” and search for a product that you know has different variants. (Whether that be colour, size etc)
  2. Select the product and scroll down to the variants on the product page.
  3. Select “Edit” and it will bring up that particular product variation.
  4. You will notice in the address bar a number at the end of that particular page URL. This is your variant ID which you will need to create a checkout link for that particular product. (40524549324974 in the example below)

The product variant URL should display something like this below:

You may want to run offers on single products that have no variants. In this case, you will have to use a different method in order to find your variant ID.

Finding variant ID in product pages
  1. Select a product that you wish to run an offer on.
  2. Go to the URL of that particular page in the address bar and add “.xml” onto the end of the page URL.
  3. Scroll down and you will see the variant section. Take that first ID line and that will be your product ID which you can use for your discount offer. (40524549324974 in the video example)

Now that you understand how to add a discount and find the variant ID of a product, you can now use this information to create an automatic checkout link. This will send customers directly to checkout without the need to manually input any discount codes. 

Note: You must set up a discount in Shopify before creating a discount checkout link.

Apply a discount to the checkout by adding:


to the end of your checkout link. For example, if you have a discount code titled “10off” to offer customers 10% off your products, add


to the end of the link.

The discount is applied automatically when a customer checks out using the specific link, as you can see from the image below.

Your link should display as something like this:

Discount Applied in Shopify

Creating discount codes as links gives your customers a quick way to access offers exclusive only to that URL.

You can create a very personalised experience for customers as well as continue to provide them value.

So, how exactly would your customers be able to use these kinds of checkout links?

Automatically generated discount codes can be used as checkout links in webpages as regular links or buttons.

This is a great way to increase customer engagement with your website as it cuts out the product selection steps and takes them directly to a point of sale, in turn driving more revenue to your business. 

2.2. Using automatically discounted checkout URLs for marketing campaigns

They can also be shared directly with customers when being used in email campaigns, social media posts, or chat messages.

This is another great way to encourage users to interact with your store and drive sales. You can also run offers against each other to see which of your campaigns prove most effective.

3. Looking for Shopify Support?

If you are looking for assistance in finding out more about Shopify as a platform, then please do not hesitate to get in touch with one of our Shopify development team who will be more than happy to assist you.

magic42 serves online retailers throughout the UK, delivering first class Magento Development and also as a Shopify partner – we power retail success. 

Get eCommerce insights to your inbox

Sign up for our monthly newsletter.

Expert Magento Developers

We’ll get your systems talking to each other and Magento & Magento 2 neatly integrated into your wider business. From advice on the best Magento & Magento 2 extensions to migrating your data or bespoke development, we’ll work with you to find the best solution for your unique business.

Powered by Retail Success

magic42 is unique in that it evolved from Mobile Fun, an award winning online retailer with 17 years’ experience, 27 international websites and a global distribution network managed from the heart of Birmingham.