Liquid operators
Liquid operators are used with tags to control flow.
If you've done any computer programming before, you'll be familiar with operators. In Liquid, operators let you make logical decisions and comparisons.
For example, you might need to check if a particular number is bigger than another number, or check to see if something has been filled in.
Mathematical operations are performed using Liquid filters, rather than operators.
Main operators
Operator
Function
==
equals
!=
does not equal
>
greater than
<
less than
>=
greater than or equal to
<=
less than or equal to
or
logical or
and
logical and
For example, here we use less than to print a statement if an opportunity charge total is less than 100.
contains
contains
Use contains
to check for the presence of a substring in a string.
It's especially useful for multi-select custom fields, where selected list options are stored as a comma-separated string.
You can't use contains
to check for an object in an array of objects. It only searches strings.
Order of operations
In tags with more than one and
or or
operator, operators are checked in order from right to left.
Last updated