Cart - Use permalinks to pre-load the cart

Topic summary

Cart permalinks allow pre-loading Shopify carts with specific products and quantities using URLs formatted as /cart/{variant_id}:{quantity}. The original tutorial explains this advanced technique can pre-fill checkout fields (email, shipping address) and include discount codes, though it’s unsupported by Shopify and requires technical knowledge.

Key URL patterns discovered:

  • Add to cart without redirect: /cart/add?id[]=variantid
  • Update quantities: /cart/update?updates[variant_id]=qty
  • Clear cart then add items: /cart/update?updates[variant_id]=0&updates[variant_id]=3
  • Apply discount and redirect: /cart/add?id[]=variant&return_to=/discount/code?redirect=/page

Common issues resolved:

  • Multiple query parameters require & not ? as separators
  • Must use variant IDs (not product IDs)
  • Encoding & as %26 needed when chaining parameters in return_to URLs
  • Province/state uses two-letter codes: &checkout[shipping_address][province]=NY

Unresolved questions:

  • Adding tags to orders via permalink (not currently supported)
  • Adding line item properties through URLs
  • Adding metafields
  • Applying discount codes to cart page (only works on checkout)

The discussion remains active with ongoing troubleshooting and workaround sharing.

Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

Nice hack. It works. It lands on the cart page instead of checkout page.

Here’s a wiki of manipulating permalinks in Shopify :

Permalink with some products, quality, addresses, email and a discount code (disc to be created beforehand) → Land on checkout page
https://xyz.myshopify.com/cart/37415174176960:1,37415180665024:2,37415188103360:3?checkout[email]=somebody@store.com&checkout[shipping_address][city]=thisismyhometown&checkout[shipping_address][zip]=90001&note=just-a-test&ref=refcode&discount=disc1

Update an item to a quantity of 10 → Land in cart
https://xyz.myshopify.com/cart/update?&updates[37415174176960]=10

Remove an item from the cart by set quantity to 0 → Land in cart
https://xyz.myshopify.com/cart/update?updates[37415174176960]=0

Remove an item from the cart and then add 3 → Land in cart
https://xyz.myshopify.com/cart/update?updates[37415174176960]=0&updates[37415174176960]=3

Clear the cart and do a parameter based redirect with return_to a preloaded cart in Checkout page → Land on checkout page
https://xyz.myshopify.com/cart/clear?return_to=/cart/37415174176960:1,37415180665024:2,37415188103360:3?checkout[email]=somebody@store.com&checkout[shipping_address][city]=thisismyhometown&checkout[shipping_address][zip]=90001&note=just-a-test&ref=refcode&discount=disc1

Clear cart, add multiple items, and land in cart page. Must encode & character to %26 or only the first item is added to cart.
https://xyz.myshopify.com/cart/clear?return_to=/cart/update?updates[37415174176960]=2%26updates[37415180665024]=4

Let me know should anything else I can add to wiki.

5 Likes