使用元字段和 IF 语句
Using metafields and IF statements
我一直在使用元字段尝试将下载列表添加到我的产品中。我有一些我希望每个产品都有的手册。
我正在使用此代码:
{% if product.metafields.document.doc_1 =='' %}
<p>There are no downloads for this product</p>
{% else %}
<h4 class="page-subheading productscategory_title">
Downloads
</h4>
<ul>
{% for field in product.metafields.document%}
<li>{{ field | last }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
但是好像不行。
这也是我可以在产品中添加指向文件的链接而无需在描述中添加链接的唯一方法吗?
尽可能为 Shopify liquid 使用布尔逻辑。有关布尔逻辑的更多详细信息和用例 - https://help.shopify.com/themes/liquid/basics/true-and-false
我一直在使用元字段尝试将下载列表添加到我的产品中。我有一些我希望每个产品都有的手册。
我正在使用此代码:
{% if product.metafields.document.doc_1 =='' %}
<p>There are no downloads for this product</p>
{% else %}
<h4 class="page-subheading productscategory_title">
Downloads
</h4>
<ul>
{% for field in product.metafields.document%}
<li>{{ field | last }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
但是好像不行。
这也是我可以在产品中添加指向文件的链接而无需在描述中添加链接的唯一方法吗?
尽可能为 Shopify liquid 使用布尔逻辑。有关布尔逻辑的更多详细信息和用例 - https://help.shopify.com/themes/liquid/basics/true-and-false