Hello.
I currently have the below liquid working on my site.
Ideally I would like the output to read “50% OFF” (if a ‘Closeout’ tag and a ‘Closeout __%’ tag are present) OR “Sale!”.
Unfortunately I’ve had to compromise with “50% OFF Sale!” or “Sale!” because I cannot get an else statement to work. I either only get “Sale!” or I get “Sale!Sale!Sale!Sale!..” repeated and sometimes “50% OFF” at the end. Moving the {% break %} around hasn’t solved it either.
{% if product.compare_at_price %}
{% for tag in product.tags %}{% if tag contains ‘Closeout’ and tag contains ‘%’ %}{{ tag | remove: "Closeout " }} OFF {% break %}{% endif %}{% endfor %}Sale!
{% endif %}
Thanks in advance for any direction. Seems like it should be easier to get working.
Side note: I have both a “Closeout” and “Closeout 50%” tag on products because I can only create a collection with tag equals (not tag contains…)