Shopify add multiple products to cart with different properties

linpap
Shopify Partner
3 0 0

I want to add different product to cart using a single add to cart button. I am using this too add the product

 

<form action="/cart/add" method="post"> 

<input name="id[]" value="29627430142024" type="hidden">
<input id="Customizer1[]" name="properties[Customizer#1]" value="RTD- 
Design1" type="hidden">
<input id="YourDesign1[]" name="properties[YourDesign1]" value="1355818798" 
type="hidden">

<input name="id[]" value="29644970950728" type="hidden">
<input id="Customizer2[]" name="properties[Customizer#2]" value="RTD- 
Design2" type="hidden">
<input id="YourDesign2[]" name="properties[YourDesign2]" value="1355818798" 
type="hidden">

<input name="return_to" value="/cart" type="hidden">
<input value="Many Products" type="submit">
</form> 

 

This forms adds the products to cart but the problem is each product has all the properties in the cart.

How do I specify which properties belong to which product in this case

Thanks in advance for your help.

0 Likes
Lixon_Louis
Shopify Partner
1174 34 229

Use Ajax API . https://help.shopify.com/en/themes/development/getting-started/using-ajax-api#add-to-cart

 

I have created an example here https://nichegeek.myshopify.com/collections/bundles/products/football-bundle

Available for hiring. Reach me at lixon@ecommercestudio.in
0 Likes
Qualitycheck
Shopify Expert
1404 114 220

Hi @linpap,

 

Hope you are doing well!

I came across your post and can help you with the same.

Yes, this is possible to add multiple products into the cart with the single add to cart button. Please check below link and let me know if this is how you want. Currently, it is adding multiple variants but multiple products can be also be added in a similar way.

 

Please check and feel free to reach out to me for further query.

Email : infoperennialsolution@gmail.com

Skype : infoperennialsolution

 

0 Likes
Qualitycheck
Shopify Expert
1404 114 220
ivanhojvat
New Member
1 0 0

You just need to name the inputs this way:

<form action="/cart/add" method="post">
<input name="items[0]id" value="29627430142024" type="hidden">
<input id="Customizer1[]" name="items[0]properties[Customizer#1]" value="RTD- Design1" type="hidden">
<input id="YourDesign1[]" name="items[0]properties[YourDesign1]" value="1355818798" type="hidden">
<input name="items[1]id" value="29644970950728" type="hidden">
<input id="Customizer2[]" name="items[1]properties[Customizer#2]" value="RTD- Design2" type="hidden">
<input id="YourDesign2[]" name="items[1]properties[YourDesign2]" value="1355818798" type="hidden">
<input name="return_to" value="/cart" type="hidden">
<input value="Many Products" type="submit">
</form>
0 Likes