Logic 如何显示标记以表示多个产品?购物液
您好,谢谢您阅读我的帖子 我收集了多种产品。在自定义集合模板上,我只想显示包含多个产品的标签(或者当该集合中有多个产品具有相同标签时) 我想会是这样的:Logic 如何显示标记以表示多个产品?购物液,logic,output,shopify,liquid,Logic,Output,Shopify,Liquid,您好,谢谢您阅读我的帖子 我收集了多种产品。在自定义集合模板上,我只想显示包含多个产品的标签(或者当该集合中有多个产品具有相同标签时) 我想会是这样的: {% for tag in collection.all_tags %} {% if tag.product.size >= 1 %} has more than 1 product. {% endif %} {% endfor %} 我已经回答了类似的问题和建议 你想要这样的东西: {% for
{% for tag in collection.all_tags %}
{% if tag.product.size >= 1 %}
has more than 1 product.
{% endif %}
{% endfor %}
我已经回答了类似的问题和建议 你想要这样的东西:
{% for tag in collection.all_tags %}
{% assign products_count = 0 %}
{% for product in collection.products %}
{% if product.tags contains tag %}
{% assign products_count = products_count | plus: 1 %}
{% endif %}
{% endfor %}
{% if products_count > 1 %}
{{ tag }}
{% endif %}
{% endfor %}