Pre-load cart with subscription/plan products using permalinks

Topic summary

Core Issue:
Users are trying to pre-load Shopify carts with subscription products using URL parameters, specifically including selling_plan IDs alongside variant IDs.

Working Solution:
Phillip_Malboeu provided a functional URL structure:

https://{SHOP}.myshopify.com/cart/clear?return_to=/cart/add?items[][id]={VARIANT_ID}%26items[][quantity]={QUANTITY}%26items[][selling_plan]{SELLING_PLAN_ID}%26return_to=/checkout

Key Technical Details:

  • The items[][] array syntax is critical for passing multiple parameters to the server
  • %26 represents URL-encoded ampersands (&)
  • Multiple products can be added by repeating the items[][id] pattern
  • Remove %26return_to=/checkout to redirect to cart page instead of checkout
  • Both subscription and non-subscription products can coexist in the same cart

Ongoing Challenges:

  • Discount codes: Multiple users report that appending %26discount=CODE to the URL doesn’t auto-apply discount codes at checkout, even though manual entry works
  • Redirect issues: Some users experience unexpected redirects to homepage after checkout instead of intended destinations

The solution is based on Shopify’s Cart Ajax API documentation.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

Hey @Phillip_Malboeu, I am trying to build a link that takes customers to a cart page (not checkout page) - that is pre loaded with any combo of subscriptions / one time products. I then want a discount code to be auto applied when they get to checkout based on the code I put in the URL, I am trying this but it isn’t working:

https://[MY STORE].myshopify.com/cart/clear?return_to=/cart/add?items[id]=[VARIANT ID]%26items[quantity]=1%26items[selling_plan]=[SELLING PLAN ID]%26items[id]= [VARIANT ID] %26items[quantity]=1?discount=[DISCOUNT CODE]

Any ideas on how I can get this to work?

Thanks

Sam