问题
Is it possible to put multiple conditions inside a single if statement in Shopify Liquid?
For example this is what I have:
{% if product.type != "A" and product.type != "B" and product.type != "C" %}
//do something
{% endif %}
The reason I'm wondering is because syntax highlighting stops after the first "and" operator, as if everything after that has incorrect syntax.
回答1:
Your syntax is 100% valid and will work in Shopify
{% if product.type != "A" and product.type != "B" and product.type != "C" %}
//do something
{% endif %}
I guess the editor what you are using has a bug in syntax highlighter for liquid. That's why you confused
来源:https://stackoverflow.com/questions/47019799/multiple-conditions-in-if-statement-liquid