How-To

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.

Brad Redding

Brad Redding is the Founder & CEO of Elevar. Specializing in analytics, tracking, GTM, and conversion optimization.

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:

variant-url

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 myshopify.com store URL version like this:

http://brevitedesign.myshopify.com/cart/2942460854298:1

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:

http://brevitedesign.myshopify.com/cart/2942460854298:1?checkout[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.

auto-add-to-shopify-cart

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!

  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.

    1. Hi Sebastian! I don’t believe this is possible to send users to the cart instead of checkout..

  2. Hi Brad, can we use this with two items in the cart/checkout? Because we are doing BOGO discount now and two items must be added.

  3. Can you do this on a product with different sizes? Is this only applicable on the sku?

    Not very customizable shopify is it? All people want me to do is buy an app for that specific query. what a joke.

  4. Has anyone got this “?checkout[reduction_code]=discountcode” part of the URL working as it does nothing for me

    Thanks

  5. Try “http://brevitedesign.myshopify.com/cart/2942460854298:1?[discount]=discountcode” with your website, your variant ID and your discount code.

  6. Hi Sam, this one works better:
    “https://www.your-website.com/discount/your-discount-code?redirect=%2Fcart/your-variant-ID:quantity”. Here’s an example with discount code “2for1″ and 2 of the product added to the cart:
    “https://www.brevitedesign.myshopify.com /discount/2for1?redirect=%2Fcart/2942460854298:2”

  7. Thanks, it is very useful.

    This type of link is directly to the checkout page:
    “https://www.your-website.com/discount/your-discount-code?redirect=/cart/your-variant-ID:quantity”

    This type of link is directly to the product page and will auto apply the discount when goes to the checkout page:
    “https://www.your-website.com/discount/your-discount-code?redirect=/products/your-product-handle”

  8. Woah! I’m really enjoying the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s very difficult to get that “perfect balance” between user friendliness and
    visual appearance. I must say you’ve done a amazing job with this.

    Additionally, the blog loads very quick for me on Safari.

    Excellent Blog!

  9. Do you know how to use this but adding two products to the cart?

    “https://www.your-website.com/discount/your-discount-code?redirect=%2Fcart/your-variant-ID:quantity”.

    Thanks

  10. Hi there! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no data backup.
    Do you have any methods to stop hackers?

  11. Hello! Quick question that’s entirely off topic. Do you know
    how to make your site mobile friendly? My blog looks weird when viewing from my apple iphone.

    I’m trying to find a template or plugin that might be able to fix
    this issue. If you have any recommendations,
    please share. Many thanks!

  12. You really make it appear so easy together with your presentation however I to find this matter to be actually one thing that I feel I’d by no means understand.
    It seems too complex and extremely vast for me. I’m looking ahead for
    your subsequent put up, I’ll attempt to get the
    hold of it!

  13. You’re so interesting! I do not suppose I’ve read a single thing like this before.
    So nice to find someone with some unique thoughts
    on this issue. Really.. thank you for starting this up.
    This website is something that’s needed on the internet, someone with some originality!

  14. Its like you read my mind! You appear to know a lot about this, like
    you wrote the book in it or something. I think that you can do with some pics
    to drive the message home a bit, but instead of that, this is
    great blog. An excellent read. I will definitely be back.

  15. Currently it looks like Expression Engine is the top blogging
    platform out there right now. (from what I’ve read) Is that
    what you’re using on your blog?

  16. We’re a gaggle of volunteers and starting a new scheme in our community.
    Your site offered us with helpful info to work on. You
    have performed an impressive activity and our entire community might be grateful to
    you.

  17. I know this if off topic but I’m looking into starting my own weblog and was wondering what all is required to
    get setup? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very internet smart so I’m not 100% sure. Any suggestions or advice would be greatly appreciated.

    Cheers

  18. Hmm it looks like your site ate my first comment (it was
    super long) so I guess I’ll just sum it up what I had written and say,
    I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but
    I’m still new to the whole thing. Do you have
    any points for beginner blog writers? I’d genuinely
    appreciate it.

  19. Wow that was unusual. I just wrote an really long comment but after I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyway, just wanted to say wonderful blog!

  20. Greetings! I know this is kinda off topic however I’d figured
    I’d ask. Would you be interested in trading links or maybe guest writing a blog post
    or vice-versa? My blog addresses a lot of the same topics as yours and I believe we could greatly benefit from each
    other. If you’re interested feel free to send me an email.
    I look forward to hearing from you! Superb blog by
    the way!

  21. Your style is unique in comparison to other people
    I have read stuff from. Many thanks for posting when you
    have the opportunity, Guess I will just bookmark this web site.

  22. Whats up this is somewhat of off topic but I was wondering
    if blogs use WYSIWYG editors or if you have to manually
    code with HTML. I’m starting a blog soon but have no coding skills so I wanted to get guidance from someone
    with experience. Any help would be enormously appreciated!

  23. This is really attention-grabbing, You’re a very skilled blogger.
    I’ve joined your rss feed and sit up for in the hunt for extra of your excellent post.
    Additionally, I’ve shared your website in my social networks

  24. Thanks for a marvelous posting! I definitely enjoyed reading it, you are a great author.
    I will remember to bookmark your blog and definitely will come back
    at some point. I want to encourage continue your great job,
    have a nice afternoon!

  25. If you are going for most excellent contents like myself, only
    pay a visit this website daily since it offers feature contents, thanks

  26. It’s nearly impossible to find knowledgeable people in this
    particular topic, but you sound like you know what you’re
    talking about! Thanks

  27. It’s a pity you don’t have a donate button! I’d
    without a doubt donate to this fantastic blog!
    I suppose for now i’ll settle for book-marking and adding
    your RSS feed to my Google account. I look forward to fresh updates and will talk
    about this site with my Facebook group. Chat soon!

  28. A motivating discussion is worth comment. I believe that you need to
    publish more on this subject, it may not be a taboo matter but generally people don’t speak about these
    issues. To the next! Cheers!!

  29. Right here is the right web site for everyone who wishes to find out about this topic.
    You understand a whole lot its almost tough to argue
    with you (not that I actually will need to…HaHa). You definitely put a new spin on a subject that’s
    been written about for many years. Wonderful stuff,
    just wonderful!

  30. Today, while I was at work, my cousin stole my iphone and tested to see if it can survive a 40 foot drop,
    just so she can be a youtube sensation. My iPad is
    now broken and she has 83 views. I know this is completely off topic but
    I had to share it with someone!

  31. Thank you, I have recently been looking for information about this subject for ages and
    yours is the greatest I have came upon so far. However, what
    about the bottom line? Are you sure concerning the supply?

  32. Hello to every body, it’s my first pay a visit of this website;
    this web site contains amazing and really fine data for readers.

Leave a Reply

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

You may also like