Stifboy
Stifboy

Reputation: 247

Shopify add multiple products to cart with different properties

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.

Upvotes: 3

Views: 1660

Answers (1)

drip
drip

Reputation: 12933

You can't add separate properties with a single add to cart button.

You will be required to make multiply AJAX call with /cart/add.js in order to create separate properties for each product.

You can refer to: https://help.shopify.com/en/themes/development/getting-started/using-ajax-api#add-to-cart

Upvotes: 1

Related Questions