简体   繁体   English

Shopify的简单液体标记不起作用……?

[英]Simple liquid markup for Shopify not working …?

I made this simple markup on a Shopify product-template.liquid section. 我在Shopify的product-template.liquid部分进行了简单的标记。 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 . 根据Shopify的文档,这似乎很简单。 However I can't get 4.png to come up on the other products in the store. 但是我无法让4.png出现在商店中的其他产品上。

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 %}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM