【发布时间】:2020-05-20 14:53:19
【问题描述】:
我有 shopify 显示正确的库存数量,但只有当我刷新每个变体的页面时。例如: 我有 12 个变体,数量从 1-8 不等,但如果我单击变体 1,它显示我有两个。如果我单击变体 6,它仍然显示我有 2,除非我单击刷新页面,然后它将显示正确的库存数量。我正在尝试解决此问题,因此当我更改变体时,价格和数量会同时更新,但不确定如何。你能帮帮我吗?
这是我正在使用的代码
{% comment %} Inventory tracking on product page {% endcomment %}
<div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}">
{% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
We have {{ current_variant.inventory_quantity }} in stock.
{% else %}
This product is available.
{% endif %}
</div>
它在第 121 行: product-template.liquid
【问题讨论】: