2015-12-10 67 views
0
{% for tag in product %} 
    {% if product.tags contains new %} 
    <span>Test</span> 
    {% endif %} 
{% endfor %} 

我需要的产品看,如果一个产品有一个叫new标签然后显示一个span标签如果不是则什么都没有。Shopify检查为标签[液体]

由于某些原因,这段代码不起作用。

回答

0

这可以做的工作:

{% for product in products %} 
    {% if product.tags contains "new" %} 
    <span>Test</span> 
    {% endif %} 
{% endfor %}