Lego2012
2/3/2017 - 4:12 PM

How to use multiple arguments in an if statement with Liquid

How to use multiple arguments in an if statement with Liquid

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

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

{% if test %}
  Yepeeee!
{% endif %}

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