我尝试了很多不同的方法,似乎没有任何东西可以将我的购物车上的自定义字段添加到购物车属性中,就像在任何地方所说的那样。我不明白。我甚至使用过Shopify的UI生成器,但它也没有用。这是我添加的代码:
<p class="cart-attribute__field">
<label for="your-name">Your name</label>
<textarea required class="required" id="your-name" name="attributes[Your name]">{{ cart.attributes["Your name"] }}</textarea>
</p>
然后我试过这个:
<div style="width:300px; clear:both;">
<p>
<label for="delivery_date">Pick a delivery date:</label>
<input required class="required" id="delivery_date" type="text" name="attributes[delivery_date]" value="{{ cart.attributes.delivery_date }}" />
<span style="display:block" class="instructions"> We do not deliver during the weekend.</span>
</p>
</div>
这也不起作用,它与attributes
有关,但我无法弄清楚是什么。
任何?
答案 0 :(得分:0)
如果您已将代码粘贴到<form>...</form>
代码中,那么我在代码中看到的问题是设置值是错误的:
<div style="width:300px; clear:both;">
<p>
<label for="delivery_date">Pick a delivery date:</label>
<input required class="required" id="delivery_date" type="date" name="attributes[delivery_date]" value="{{ cart.attributes["delivery_date"] }}" />
<span style="display:block" class="instructions"> We do not deliver during the weekend.</span>
</p>
</div>
您可以在开发商店看到这个:https://kotn-eu.myshopify.com pwd skufom
答案 1 :(得分:-1)
在液体购物车部分的<form>
标记内,您应添加名称属性为input
的{{1}}或textarea
。
例如:
note