Operators

Liquid supports many operators that can be used in your conditional statements.

Syntax Operator Description
== equals
!= does not equal
> greater than
< less than
>= greater than or equal to
<= less than or equal to
or condition A or condition B
and condition A and condition B
contains checks to see if a string or string array contains a string

Operator Examples

Here are some examples of how these operators could be helpful for your marketing campaigns:

Choose Message via Integer Custom Attribute

Total Spend

In this example, if a customer’s “Total Spend” custom attribute is greater than 0, they will get the message:

1
Thanks for purchasing! Here's another 10% off!

If a customer’s “Total Spend” custom attribute does not exist or is equal to 0, they will get the following message:

1
Buy now! Would 5% off convince you?

Copyable Code for this Example:
1
2
3
4
5
{% if {{custom_attribute.${Game}}} == Game1 %}
You played our Game! We're so happy!
{% else %}
Hey! Get in here and play this Game!
{% endif %}


Choose Message via String Custom Attribute

Games Played

In this example, if you have played a certain game, you’ll receive the following message:

1
You played our Game! We're so happy!

If you played another specified game:

1
You played our other Game! Woop!

If you haven’t played any games, or that custom attribute doesn’t exist on your profile, you’d get the following message:

1
Hey! Get in here and play this Game!

Copyable Code for this Example:
1
2
3
4
5
6
7
{% if {{custom_attribute.${Game}}} == Game1 %}
You played our Game! We're so happy!
{% elsif{{custom_attribute.${Game}}} == Game2 %}
You played our other Game! Woop!
{% else %}
Hey! Get in here and play this Game!
{% endif %}


Abort Message Based on Location

You can abort a message based on just about anything. The example below shows how you can abort a message if a user is not based in a specified area, as they might not qualify for the promotion, show, or delivery.

Abort Message If

You can also abort messages based on Connected Content.

Copyable Code for this Example:
1
2
3
4
5
{% if {{${time_zone.$}}} =='America/Los_Angeles' %}
Steam now!
{% else %}
{% abort_message () %}
{% endif %}


WAS THIS PAGE HELPFUL?
New Stuff!