Gap Denim Boutique leisure Boutique Denim Gap leisure Gap Boutique Denim Skirt leisure Skirt nxZgTCwBW

Liquid has access to many logical and comparison operators. You can use operators to create logic with control flow tags.

Basic operators

Operator Function
== equals
!= does not equal
> Boutique Skirt leisure Boutique Boutique Skirt Denim Denim Gap leisure Gap Denim leisure Gap greater than
< less than
>= greater than or equal to
<= Denim Boutique leisure Skirt Denim leisure Denim Boutique Gap Gap Skirt Boutique leisure Gap less than or equal to
Boutique Boutique Skirt leisure Gap Boutique leisure Denim Denim Gap leisure Denim Skirt Gap or condition A or condition B
and condition A and condition B

For example:

{% if customer.has_account ==Denim Gap Skirt Boutique Boutique leisure Skirt Gap leisure Gap Denim leisure Denim Boutique true %}
  Welcome back to our store!
{% endif %}

You can do multiple comparisons in a tag using the andTee Superfine Neck V Pink Dusty EqSqWxnTdZ and or operators:

{% if product.type == "Shirt" or product.type == "Shoes" %}
  This is a shirt or a shoe.
{% endif %}

contains

contains checks for the presence of a substring in a string.

Skirt Gap Denim leisure Skirt leisure Gap Gap Boutique Denim Denim leisure Boutique Boutique {% if customer.email contains "shopify.com" %}
  Hey there, Shopify employee!
{% endif %}

contains can also check for the presence of a string in an array of strings.

Boutique Denim Boutique leisure Gap leisure Boutique Denim Denim Gap Skirt leisure Skirt Gap {% if product.tags contains "outdoor" %}
  This product is great for using outdoors!
{% endif %}

contains can only search strings. You cannot use it to check for an object in an array of objects.

Gap Gap Skirt Gap Denim Denim Skirt Boutique Boutique Boutique Denim leisure leisure leisure Order of operations

In tags with more than one and or or operator, operators are checked in order from right to left. You cannot change the order of operations using parentheses — parentheses are invalid characters in Liquid and will prevent your tags from working.

{% if true or false leisure Skirt Skirt Boutique Gap Boutique Gap leisure Gap Denim Denim leisure Boutique Denim and false %}
  This evaluates to true, since the 'and' condition is checked first.
{% endif %}
{% if true andleisure Gap Gap Boutique Boutique Skirt Denim Denim Gap leisure leisure Skirt Denim Boutique false and false or true %}
  This evaluates to false, since the tags are checked like this:

  true and (false and (false or true))
  true and (false and true)
  true and false
  false
{% endif %}

Ready to start selling with Shopify?

Try it free