Funelyze

Shopify cart permalinks with a discount code, on any theme

The URL format that adds a product to a Shopify cart from any link, applies a discount code on the way and sends the shopper to checkout. No app, no theme code.

22 September 2026 · 3 min read

A cart permalink is a plain URL that adds a product to a Shopify cart. It works on every theme, needs no app, and you can put it in an email, a quiz result, a QR code or a chat message. Add a discount code to the same URL and the shopper lands in checkout with the price already reduced. This guide covers the format, the discount trick, and the mistakes that make the link silently do nothing.

The basic format

https://your-store.com/cart/VARIANT_ID:QUANTITY

VARIANT_ID is the numeric id of the variant, not the product. QUANTITY is how many. For example:

https://your-store.com/cart/44810212345678:1

Open it and Shopify adds one of that variant to the cart, then shows the cart page.

To add several products in one link, separate them with commas:

https://your-store.com/cart/44810212345678:1,44810212399999:2

Adding a discount code

Append ?discount=CODE and Shopify applies the code to the cart on the way through:

https://your-store.com/cart/44810212345678:1?discount=QUIZ10

The code must exist and be active in Discounts in your admin. It follows the normal rules: usage limits, minimum order, product restrictions. If the code does not apply, the product still lands in the cart and the shopper sees the full price, so test the exact link once before you send it anywhere.

Sending them straight to checkout

The cart page is a stop most shoppers do not need. Two options:

  • Add ?storefront=true to some themes and Shopify jumps to checkout; behaviour varies by theme and market, so test it.
  • Keep the cart page but make sure the discount is already applied, which is what the discount parameter does. A visible discount on the cart page is a reason to continue, not a reason to leave.

Finding a variant id

The quickest way with no app: open the product page on your storefront, add .json to the end of the URL, and read the variants array. Each entry has an id. Or in the admin, open the product, click the variant, and the id is the last number in the address bar.

Where this goes wrong

  • Product id instead of variant id. The link opens an empty cart or a 404. Every product has at least one variant even if it has no options; use that id.
  • Sold-out variant. Shopify refuses to add it and shows the cart unchanged. Point at a variant you keep in stock, or update the link when stock changes.
  • Code with a space or lowercase. Discount codes are matched loosely, but a code with a trailing space in your admin will never apply. Copy it exactly.
  • Custom storefront domain vs. myshopify domain. Use the domain your customers see. A link on the .myshopify.com domain works but redirects, and some browsers drop the discount parameter on the way.

Using them in a quiz result

This is where permalinks earn their keep. A product finder ends with "here is the one for you", and the button on that page should not be "view product". It should be "add to cart with your 10% off", and it should work without an app.

In Funelyze, each result product carries a variant id and the quiz has one discount code. The result button builds the permalink for you, with the code applied, on any theme. If you would rather not use permalinks, the Shopify app adds the product to the cart in place and writes the quiz response id onto the order as a cart attribute, so you can trace every sale back to the quiz.

Try it on the product finder template: the result page uses exactly this mechanism. Then build one from your website, free, no card.