I have a problem with a if else statement.
I have a collection which sort by 2 different tags: material and size.
I want an heading and paragraph to show, when neither a material or material and size is chosen.
You can see the collection here: https://www.sengefabriksudsalg.dk/collections/madrasser/
I have tried this:
{% if pageValues contains 'Latexmadrasser' %}
<h2 class="mat-h2-collecion">Latexmadrasser</h2>
<p> Hello </p>
{% elsif pageValues contains 'Latexmadrasser' and '70x200' %}
<h2 class="mat-h2-collecion">Latexmadrasser 70x200</h2>
<p> Hello </p>
{% endif %}
But it prints only the first statement 🙁
2
Answers
Re-order your clauses from most to least specific. Your second clause would only ever be evaluated if
pageValue
does not include ‘Latexmadrasser’, since this condition would already be enough to satisfy the firstif
, so you’ll never reach theelif
.shouldn’t this be:
my liquid is not up to date though.