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.

In case you are still around, this is something I am trying to do now and cannot seem to get done right.

Here is an example of one link for a product that is working fine https://d7ea93.myshopify.com/cart/clear?return_to=%2Fcart%2Fadd%3Fitems%5B0%5D%5Bid%5D%3D45203860914466%26items%5B0%5D%5Bquantity%5D%3D1%26items%5B0%5D%5Bselling_plan%5D%3D4684546338%26return_to%3D%252Fcheckout%253F

Here is the product I am trying to do it for

{“product”:{“id”:8565646623010
product variant: 46559953486114
selling id 5905056034

This is what I have tried to do so far and it isn’t working [https://d7ea93.myshopify.com/cart/clear?return_to=/cart/add?items8565646623010id=46559953486114%26items8565646623010quantity=1%26items8565646623010selling_plan=5905056034%26return_to=/checkout%253F`](https://d7ea93.myshopify.com/cart/clear?return_to=/cart/add?items8565646623010id=46559953486114%26items8565646623010quantity=1%26items8565646623010selling_plan=5905056034%26return_to=/checkout%253F`)

What am I missing?