Reputation: 133
I have an if statement which works perfectly.
However, when I add an elsif into the mix only if runs and the elsif just works no matter what. The syntax highlighting doesn't work i.e the contains doesn't go bold and the tags in product.tags doesn't italicise.
{% if customer.tags contains 'Approved' %}
Show approved task.
{% elsif customer.tags contains 'Waiting Approval' %}
Show waiting approval task.
{% endif %}
The syntax highlighting doesn't work on the elsif when editing in the Shopify liquid editor. Which it should do.
What may be the problem here?
I can't use {% else %}
here, because I need to specifically look for one or the other, as there are other tags used, which wont be used in this instance.
Upvotes: 1
Views: 1329
Reputation: 4073
No Idea why the syntax wont work for your, the documentation looks like elsif should work. https://help.shopify.com/en/themes/liquid/tags/control-flow-tags
However, your logic should be fine if you do:
{% if product.tags contains 'Approved' %}
Show approved task.
{% endif %}
{% if product.tags contains 'Waiting Approval' %}
Show waiting approval task.
{% enfid % }
-> These are 2 ifs. But you said "look for one or the other" - if only one condition can be true, it's fine.
Upvotes: 1