How to Auto-Add Products & Discount to Shopify Cart via URL

See how to quickly build custom links to use in emails, landing pages, and more to auto-add products and discounts to the cart.

Landing pages have been quite the craze with the growth of tools like Shogun, Zipify Pages, Click Funnels, etc. We’re seeing more and more prospecting campaigns driving traffic directly to these pages promoting only one (or a few) products vs a full collection page of products.

These can be very successful especially those with great storytelling like we’ve seen with Truvani (aka The Food Babe) and Ylonn.

Success on this type of landing page can vary widely. A big part of this is the audience you are sending here – how qualified are they for this specific offering?

If you have found yourself creating landing pages or thinking about it – then creating a seamless experience for the user to add to cart, apply a discount, and redirect to the checkout is a no-brainer.

This prevents the awkward experience where you are sending users to the product page to add from the landing page. Or gasp if you are trying to use the Buy Now button channel!

This quick tip shows how to auto-add a product to your cart and automatically redirect to the Shopify checkout page (Shopify calls it a cart permalink).

Step 1: Pick your product

Inside of your Shopify admin find your product that you want to auto-add to cart and go to your browser bar:


Step 2: Add .xml to the end of your product URL

Once you’ve found your product then add .xml to the end of the URL and refresh your browser. This should bring up an XML (code) looking page:

variantid xml

Step 3: Find and save the variant ID

Once you’ve loaded the XML version of the page then look for the <id> nested under the variant details as shown highlighted in the image above.

Step 4: Build your Link

Now save this ID for one or more products and start building your link.

The link should be your store URL version like this:

Where the bolded number is the variant ID from step 3 and then use a :1 for the quantity added. In this example above I am adding a quantity of 1 to the cart.

Step 5: Optionally add a discount code

If you want to auto-apply a discount then you can do this by adding a parameter to the end: ?checkout[reduction_code]=discountcode

Where discountcode is your discount code.

So in this example our URL would now be:[reduction_code]=discountcode

Step 6: Test your link

Now test your link! Open a new browser window => paste your URL => and verify the product is added to the cart for you.


That’s it!

You can now auto-add products to the cart, with a discount, using a simple URL.

This can be done on blogs, landing pages, emails, etc.

Good luck!

Get Exclusive Elevar Insights directly to your inbox.

Get free analytics tips and resources delivered directly to your inbox.

Conversion Rate Falling Flat?

Avoid The 9 Mistakes That Prevent Conversion Rates from Scaling

Download Now

Brad Redding

Brad, co-founder of Elevar, has lived in eCommerce for over 12 years. He's helped design, build, and optimize over 100 websites in his career. From new retail startups to well-known brands like Le Creuset, Signature Hardware, Rebecca Minkoff, Char-Broil and more, he specializes in data analytics and conversion optimization to help achieve business goals.

  1. Amazing, now I want to do this for bundles eg buy 2 for $x can this be done and what additions would need to added? So clicking the link would add two of the same product to the cart with the discount applied.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Articles