Ah take a look at the accepted solution @WowieDogs , the items[] before each argument are important! It makes it so you’re sending an array to the server.
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 %26represents URL-encoded ampersands (&)- Multiple products can be added by repeating the
items[][id]pattern - Remove
%26return_to=/checkoutto 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=CODEto 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.