Html Shopify-无法获取自定义购物车字段以显示在订单注释\u属性中

Html Shopify-无法获取自定义购物车字段以显示在订单注释\u属性中,html,shopify,Html,Shopify,我尝试了许多不同的方法,但似乎没有什么能像everywhere所说的那样将我的购物车上的自定义字段添加到购物车属性中。我不明白。我甚至使用过Shopify的UI生成器,但这也不起作用。以下是我添加的代码: <p class="cart-attribute__field"> <label for="your-name">Your name</label> <textarea required class="required" id="you

我尝试了许多不同的方法,但似乎没有什么能像everywhere所说的那样将我的购物车上的自定义字段添加到购物车属性中。我不明白。我甚至使用过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>
这也不起作用,它与属性有关,但我不知道是什么


有人吗?

在“液体车”部分的标签内,您应该添加输入或带有名称属性注释的文本区域

例如:

...
<form action="/cart" method="post" novalidate>
...
    <textarea name="note">{{ cart.note }}</textarea>
...
</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>

您可以在开发商店看到这一点:pwd skufom

海报专门询问购物车属性,这与购物车注释不同。他们可能已经在使用note字段了。在{{cart.attributes.delivery_date}}和cart.attributes['delivery_date']}之间没有功能上的区别-这两种语法都是有效的。我认为问题在于OP要么在购物车表单中没有代码,要么表单有一个指向/checkout的超链接,而不是一个名为=checkout的提交按钮——这两种情况都会阻止数据被发布到Shopify@DaveB我同意不应该有,但我已经有足够多的奇怪的影响,我仍然感到惊讶当cleaner语法起作用时。我也同意最有可能的原因是安置,但OP从未验证过这两种情况,所以谁知道呢。