How to use multiple arguments in an if statement with Liquid

前端 未结 2 1341
滥情空心
滥情空心 2020-12-14 06:09

I want to use an if statement in Liquid with multiple conditionals. Something like:

{% if (include.featured == \"true\" and product.featured ==          


        
2条回答
  •  感情败类
    2020-12-14 06:57

    Another way you can condense this is to combine else if statements, and booleans don't necessarily need the "==" when evaluating true:

    {% if include.featured and product.featured %}
          {% assign test = true %}
    {% elsif include.featured == false and product.featured == false %}
          {% assign test = false %}
    {% endif %}
    

提交回复
热议问题