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.
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:
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:
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:
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.
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.