Shopify - 无法获取自定义购物车字段以便按顺序显示note_attributes

时间:2017-11-03 14:49:41

标签: html shopify

我尝试了很多不同的方法,似乎没有任何东西可以将我的购物车上的自定义字段添加到购物车属性中,就像在任何地方所说的那样。我不明白。我甚至使用过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有关,但我无法弄清楚是什么。

任何?

2 个答案:

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