首页 > 解决方案 > Shopify - 自定义购物车属性未显示在订单 API 的 note_attributes 中

问题描述

我正在尝试为授权离开添加一个新复选框。按照 shopify 网站中的步骤操作:https ://help.shopify.com/en/themes/customization/cart/get-more-information-with-cart-attributes

该复选框显示在页面中,但在调用订单 API 检索交易时,note_attributes 字段始终为空。

我联系了 shopify 支持,他们说代码看起来不错,但他们无法解释为什么它没有出现在 note_attributes 中。

已经使用 shopify UI 生成器并尝试检查 shopify 论坛无济于事。

我已经更新了 cart-template.liquid 并在<form> .. </form>标签下面添加了

<p class="cart-attribute__field">
              <input type="hidden" name="attributes[Authority To Leave]" value="No">
              <input type="checkbox" name="attributes[Authority To Leave]" value="Yes" checked>
              <label>Authority To Leave</label>
</p>

我似乎无法弄清楚为什么它没有出现在 note_attributes 字段中。感谢有人能对此有所了解。

标签: htmlapishopify

解决方案


推荐阅读