【问题标题】:Shopify add multiple products to cart with different propertiesShopify 将具有不同属性的多个产品添加到购物车
【发布时间】:2020-01-03 08:19:30
【问题描述】:

我想使用一个添加到购物车按钮将不同的产品添加到购物车。 我也在用这个添加产品

<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>  

此表单将产品添加到购物车,但问题是每个产品都具有购物车中的所有属性。

在这种情况下如何指定哪些属性属于哪个产品

提前感谢您的帮助。

【问题讨论】:

    标签: shopify shopify-template


    【解决方案1】:

    您不能使用单个添加到购物车按钮添加单独的属性。

    您需要使用/cart/add.js 进行多重AJAX 调用,以便为每个产品创建单独的属性。

    您可以参考:https://help.shopify.com/en/themes/development/getting-started/using-ajax-api#add-to-cart

    【讨论】:

      猜你喜欢
      • 2017-11-19
      • 1970-01-01
      • 2013-05-07
      • 2017-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 1970-01-01
      相关资源
      最近更新 更多