Pre-load cart with subscription/plan products using permalinks

Solved
Jinxo
Tourist
3 0 3

Can permalink attributes be used to pre-load the cart with subscription/plan products? There's an option to include a product variant id, but can we include a plan id?

saeba
Tourist
6 0 3

I have a same question.

0 Likes
Phillip_Malboeu
Shopify Partner
12 1 5

Would love to have an answer to this as well.

0 Likes
Phillip_Malboeu
Shopify Partner
12 1 5

This is an accepted solution.

Hey @Jinxo and @saeba!

I believe I figured it out, this url will clear the cart, add items with a selling_plan and then redirect to checkout:
`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`

To head to the cart page instead of directly to checkout, you can remove the `%26return_to=/checkout`.

Cheers,
Phil

saeba
Tourist
6 0 3

Yes that works!

Thanks Phillip!

Jinxo
Tourist
3 0 3

Awesome! I'll try it out. 

0 Likes
kevnord
New Member
1 0 0

This worked! Thank you so much for posting the solution. I was pulling my hair out.

0 Likes
achieve
New Member
2 0 1

Hi Phillip, thank you for providing the solution to add a subscriptions product directly to the cart.  I can't figure out how to add a second or subsequent variant and quantity.  Can you assist?

happygree
New Member
1 0 0

Hi, have you figured this out? I still don’t understand how to add additional subsequent variants.

0 Likes
Phillip_Malboeu
Shopify Partner
12 1 5

Hi @happygree and @achieve,

Sorry for the late reply! You can always add more variants by adding more `items[][id]`, like so:
`https://{SHOP}.myshopify.com/cart/clear?return_to=/cart/add?items[][id]={VARIANT_ID}%26items[][quantity]={QUANTITY}%26items[][selling_plan]={SELLING_PLAN_ID}%26items[][id]={SECOND_VARIANT_ID}%26items[][quantity]={SECOND_QUANTITY}%26items[][selling_plan]={SELLING_PLAN_ID}%26return_to=/checkout`

Cheers,
Phil