Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: "This reference page notes the operators that Liquid supports, as w

> Liquid supports many [operators](https://docs.shopify.com/themes/liquid/basics/operators) that can be used in your conditional statements. This page covers the operators that Liquid supports and provides use cases of how you can use them in your messages.

This table lists the operators that are supported. Note that parentheses are invalid characters in Liquid and prevents your tags from working.
This table lists the operators that are supported. Note that parentheses are invalid characters in Liquid and prevent your tags from working.

| Syntax| Operator Description|
|---------|-----------|
Expand All @@ -29,7 +29,7 @@ This table lists the operators that are supported. Note that parentheses are inv

Let's go through a few tutorials to learn how to use these operators for your marketing campaigns:

### Choose message with an integer custom attribute
### Choose a message with an integer custom attribute

Let's send push notifications with personalized promotional discounts to users who have or haven't made purchases. The push notification will use an integer custom attribute called `total_spend` to check a user's total spend.

Expand Down Expand Up @@ -75,7 +75,7 @@ Need a sign to update your wardrobe? We added a 15% discount code to your accoun
{% endraw %}
{% enddetails %}

Now if a user's "Total Spend" custom attribute is greater than `0`, they will get the message:
Now, if a user's "Total Spend" custom attribute is greater than `0`, they will get the message:

```
Surprise! We added a 15% discount code to your account that automatically applies to your next order.
Expand All @@ -86,7 +86,7 @@ If a user's "Total Spend" custom attribute does not exist or is equal to `0`, th
Need a sign to update your wardrobe? We added a 15% discount code to your account that will automatically apply to your first order.
```

### Choose message with a string custom attribute
### Choose a message with a string custom attribute

Let's send push notifications to users, and personalize the message based on each user's most recently played game. This will use a string custom attribute called `recent_game` to check which game a user has last played.

Expand All @@ -110,11 +110,11 @@ Your fleet awaits your next orders. Log on when you're ready to rejoin the war f
{% endraw %}

{: start="3"}
3. Use the `elsif` tag with the does not equal (`!=`) and "and" (`&&`) operators to check if the user has a recent game (meaning the value isn't blank), and that the game isn't *Awkward Dinner Party* or *Proxy War 3: War of Thirst*. Then, create a message to send to those users.
3. Use the `elsif` tag with the "does not equal" (`!=`) and "and" (`and`) operators to check if the user has a recent game (meaning the value isn't blank), and that the game isn't *Awkward Dinner Party* or *Proxy War 3: War of Thirst*. Then, create a message to send to those users.

{% raw %}
```liquid
{% elsif {{custom_attribute.${recent_game}}} != blank && 'Awkward Dinner Party' or 'Proxy War 3: War of Thirst' %}
{% elsif {{custom_attribute.${recent_game}}} != blank and {{custom_attribute.${recent_game}}} != 'Awkward Dinner Party' and {{custom_attribute.${recent_game}}} != 'Proxy War 3: War of Thirst' %}
Limited Time Deal! Get 15% off our best-selling classics!
```
{% endraw %}
Expand Down Expand Up @@ -145,7 +145,7 @@ Hey! I've got a deal for you. Buy 2 of our newest releases and get 10% off!
You are formally invited to our next dinner party. Log on next week for another round of delectable dishes and curious conversations.
{% elsif {{custom_attribute.${recent_game}}} == 'Proxy War 3: War of Thirst' %}
Your fleet awaits your next orders. Log on when you're ready to rejoin the war for hydration.
{% elsif {{custom_attribute.${recent_game}}} != blank && 'Awkward Dinner Party' or 'Proxy War 3: War of Thirst' %}
{% elsif {{custom_attribute.${recent_game}}} != blank and {{custom_attribute.${recent_game}}} != 'Awkward Dinner Party' and {{custom_attribute.${recent_game}}} != 'Proxy War 3: War of Thirst' %}
Limited Time Deal! Get 15% off our best-selling classics!
{% else %}
Hey! I've got a deal for you. Buy 2 of our newest releases and get 10% off!
Expand Down
Binary file modified assets/img/liquid-if-elsif-games.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.