Liquid templating in messages allows for greater flexibility in creating dynamic and powerful messages for your customers. You can use Liquid syntax to manage content in emails, text messages (SMS/MMS), and push notifications.
Basics
Liquid is an open-source templating language created by Shopify. The official documentation can be found here. Liquid code has three elements: objects, tags, and filters. Omnisend uses Liquid syntax with a simple difference - double square braces [[ ]]
Instead of double curly braces {{ }}
and [% %]
braces instead of {% %}
.
[[ contact.email ]]
Objects
Objects are variable names. Liquid objects contain attributes to output dynamic content in your message. For example, you can use variables stored in your contact profiles. Objects are always enclosed within double square braces.
[[ contact.first_name ]]
All objects available in Omnisend are grouped into themes based on data type.
Major themes are contact’s (subscriber’s) properties (name structured as [[ contact.variable ]]
and account properties (name structured as [[ account.variable ]]
as well as order properties (name structured as [[ order.variable ]]
) and cart properties (name structured as [[ cart.variable ]]
) for automation workflows.
View the full list of objects available in Omnisend in the reference table below.
Tags (Automations only)
Tags are used to create the logic and control flow for templates. Square braces and percent signs denote tags: [%
and %]
. They produce no visible text.
[% if contact.first_name %] Hi [[ contact.first_name ]] [% endif %]
View all Liquid tags here.
Filters
Filters are used to change the output of a Liquid object. Filters are used within an output (in curly braces) and are separated by a |
(pipe).
[[ 'mywebsite.com/orders/' | append: order.order_id ]]
View all Liquid filters here.
Common Use-Cases
Here are several helpful common use-cases for Liquid syntax:
Personalization
Hi [[ contact.first_name ]], welcome to Omnisend!
Tip: This filter automatically adjusts the name to its vocative form in supported languages, making your messages sound more natural and personal. This can be achieved by using vocative personalization:
[[ contact.first_name | vocative ]]
Personalization with fallback
Hi [[ contact.first_name | default: 'there' ]], welcome to Omnisend!
Personalization with name capitalization
Hi [[ contact.first_name | capitalize | default: 'there' ]], welcome to Omnisend!
Variable insertion
Variable insertion can be used in many different parts of various messages. You can insert order data or order sum in different places of the message body.
Conditional Statements (Automations only)
Language localization
[% if contact.custom_properties.language == 'Spanish' %] Hola [[ contact.first_name ]]! [% elsif contact.custom_properties.language == 'French' %] Bonjour [[ contact.first_name ]]! [% else %] Hi [[ contact.first_name ]]! [% endif %]
Content recommendations
[% if contact.country == 'UK' or contact.country == 'Ireland' %] Have you visited our newest flagship store in London? [% endif %]
Formatting
User name capitalization
Hi [[ contact.first_name | capitalize ]]
Appending custom text
[% assign campaign_destination = '/landing_page.html' %] [[ account.website | append: campaign_destination ]]
Time formatting
Omnisend © [[ current_date | date:'%Y' ]]
Objects' reference table
Group | Dropdown title | Tag | Value type | Description |
Contact |
| string | Contact email | |
Contact | Name |
| string | Contact's first name |
Contact | Surname |
| string | Contact's last name |
Contact | City |
| string | Contact's city |
Contact | Country |
| string | Contact's country |
Contact | State |
| string | Contact's state |
Contact | Postal code |
| string | Contact's postal code |
Contact | Unsubscribe link |
| - | Contact's link to unsubscribe |
Contact | Preference center link |
| - | Contact preference link to apply changes |
Contact | Custom properties |
| object | Contact's custom properties |
Contact | Phone number |
| string | Contact's phone number |
Account | Name |
| string | Account's name |
Account | Address |
| string | Account's address |
Account | City |
| string | Account's city |
Account | ZIP / Postal code |
| string | Account's ZIP / Postal code |
Account | Country |
| string | Account's country |
Account | Website URL |
| string | Account's website URL |
Account | Time zone |
| string | Account's timezone |
Account | Currency |
| string | Account's currency |
Date | Current day |
| - | The day on which the action is performed |
Date | Current day name |
| - | The day on which the action is performed |
Date | Current month |
| - | The month when the action is performed |
Date | Current month name |
| - | The month name when the action is performed |
Date | Current year |
| - | The current year when the action is performed |
Order | Order ID |
| string | Order's ID |
Order | Order number |
| int64 | Order's number |
Order | Order name |
| string | Order's name |
Order | Order date |
| Date | Date when order is created |
Order | Currency |
| string | Order's currency |
Order | Total price |
| int64 | Order's sum in total |
Order | Subtotal price |
| int64 | Subtotal order's sum |
Order | Discount |
| int64 | Order's discount |
Order | Shipping price |
| int64 | Order's shipping price |
Order | Order status page URL |
| string | URL to reach exact order information |
Order | Order note |
| string | Additional order notes |
Billing address | First name |
| string | Contact's first name provided in billing address |
Billing address | Last name |
| string | Contact's last name provided in billing address |
Billing address | Country |
| string | Contact's country provided in billing address |
Billing address | Country code |
| string | Contact's country code provided in billing address |
Billing address | State |
| string | Contact's state provided in billing address |
Billing address | State code |
| string | Contact's state code provided in billing address |
Billing address | City |
| string | Contact's city provided in billing address |
Billing address | Address 1 |
| string | Contact's address (1st line) provided in billing address |
Billing address | Address 2 |
| string | Contact's address (2nd line) provided in billing address |
Billing address | ZIP / Postal code |
| string | Contact's ZIP / Postal code provided in billing address |
Billing address | Company |
| string | Contact's company title provided in billing address |
Billing address | Phone |
| string | Contact's phone number provided in billing address |
Shipping address | First name |
| string | Contact's first name provided in shipping address |
Shipping address | Last name |
| string | Contact's last name provided in shipping address |
Shipping address | Country |
| string | Contact's country provided in shipping address |
Shipping address | Country code |
| string | Contact's country code provided in shipping address |
Shipping address | State |
| string | Contact's state provided in shipping address |
Shipping address | State code |
| string | Contact's state code provided in shipping address |
Shipping address | City |
| string | Contact's city provided in shipping address |
Shipping address | Address 1 |
| string | Contact's address (1st line) provided in shipping address |
Shipping address | Address 2 |
| string | Contact's address (2nd line) provided in shipping address |
Shipping address | ZIP / Postal code |
| string | Contact's ZIP / Postal code provided in shipping address |
Shipping address | Company |
| string | Contact's company title provided in shipping address |
Shipping address | Phone |
| string | Contact's phone number provided in shipping address |
Cart | Abandoned cart URL |
| string | URL to reach/recover abandoned cart |