I made this simple markup on a Shopify product-template.liquid section. It's not returning the second image though on different products outside of the ones specified.
{% if product.handle == "e" or "f" %}
{{ '3.png' | asset_url | img_tag }}
{% else %}
{{ '4.png' | asset_url | img_tag }}
{% endif %}
This seems pretty straight forward according to Shopify's documentation . However I can't get 4.png to come up on the other products in the store.
This seems like a really basic problem, but it's doing me in! What am I missing?
You can't chain conditional statements in liquid you need to redefine the comparison.
{% if product.handle == "e" or product.handle == "f" %}
{{ '3.png' | asset_url | img_tag }}
{% else %}
{{ '4.png' | asset_url | img_tag }}
{% endif %}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.