Reputation: 11
I'm working on rewriting the if statements for my collection page on shopify. I'm trying to get the item-price line to show the text 'out of stock' when the product is unavailable/when all variants are sold out. I can get the code working if it's under 3 conditions, but not sure how to add an additional condition.
the 4 conditions are:
if the product is on sale, show the price comparison
if the product price varies, show the lowest price
if the product and all variants sold out, show out of stock text
else, show normal pricing
I've tried a few different ways, below are what I'm stuck on...Any help is appreciated!
img1
Upvotes: 1
Views: 3421
Reputation: 1132
It's because in liquid the else if syntax is elsif
instead of elseif
.
Try something like this {% if x %} {% elsif y %} {% elsif z %} {% else %} {% endif %}
Upvotes: 2