Liquid includes many logical and comparison operators.
Basic operators
== |
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:
Input
{% if Donation.Amount >= 50 %}
Thank you for your generous donation!{% endif %}
You can use multiple operators in a tag:
Input
{% if Recipient.Type == "Team" or Recipient.Type == "Fundraiser" %}
This is a team or fundraiser.{% endif %}
contains
contains checks for the presence of a substring inside a string.
Input
{% if Team.Name contains 'Team' %}
This team's name contains the word Team.{% endif %}
contains can also check for the presence of a string in an array of strings.
contains can only search strings. You cannot use it to check for an object in an array of objects.contain