Liquid Tags

Prev Next

Liquid Tags are released in beta and can be activated for the accounts with the new email editor

Liquid is an open-source templating language created by Shopify. It provides a powerful way to pull user data into your messages and dynamically adapt content. By inserting Liquid tags, you can tailor each message to the individual, whether that means showing a unique offer, referencing a subscription anniversary, or adjusting the content based on user behavior.

This article covers the following concepts:

  • What is Liquid?

  • What does Liquid offer?

  • Use cases

  • Best practices

What is Liquid?

Liquid acts as a placeholder system inside your message. It retrieves consented user profile information and allows you to personalize content at scale.

Instead of sending the same message to everyone, you can enrich your communications with dynamic text, logic, and contextually relevant details, adding a meaningful personal touch that improves engagement.

What does Liquid offer?

  • Dynamic personalization: Real-time customization based on user attributes such as dates, preferences, purchase history, and more.

  • Easy to learn: With its clean and simple syntax, Liquid is accessible to both marketers and developers.

You can use Liquid for many purposes. It's a flexible templating language commonly used for dynamic personalization. It is widely used for the following functionalities:

  • Variables: Pull user profile fields (e.g., first name, last purchase date) directly into your content.

  • Conditionals: Display specific content blocks or designs to end-users based on defined conditions (e.g., VIP customers, country, product interest).

  • Loops: Iterate through lists such as recent purchases, recommended products, or any array-based data.

  • Date and time formatting: Format dates and times exactly as you prefer (e.g., localized formats, custom styles).

  • String and math operations: Modify text (uppercase, split, replace) or perform simple calculations inside your content.

  • Filters: Transform variables using built-in or custom filters (e.g., currency formatting, truncation, rounding).

  • Fallback handling: Provide default values when data fields are empty to avoid broken personalization.

Use cases

Liquid tags allow you to create dynamic, personalized messages across almost all messaging channels, including email, push notifications, SMS, in-app messages, and more. By pulling user attributes into your templates and applying logic, calculations, and formatting, Liquid helps every message adapt in real time to the individual receiving it. This page provides a comprehensive reference to common Liquid use cases with practical examples, helping you build smarter, more relevant communications.

Anniversaries and special dates

Celebrate user milestones or avoid sending messages on holidays.

Anniversary

{% assign signup_years = 'now' | date: "%Y" | minus: user.signup_date | date: "%Y" %}
{% if signup_years > 0 %}
Happy {{ signup_years }} year anniversary!
{% endif %}

Birthday

{% assign birth_month = user.date_of_birth | date: "%m" %}
{% assign current_month = 'now' | date: "%m" %}
{% if birth_month == current_month %}
Happy Birthday! 🎉
{% endif %}

Conditional logic

Show content based on user attributes or behavior.

{% if user.subscription_status == 'active' %}
Thank you for being a subscriber!
{% else %}
Subscribe now to get exclusive benefits.
{% endif %}

Loops

Display multiple items or iterate through lists

{% for item in user.favorite_products %}
- {{ item.name }}: ${{ item.price }}
{% endfor %}

Date and time calculations

Manipulate dates for reminders, countdowns, or scheduling.

Add duration to date

{{ 'now' | date:"%s" | plus: 259200 | date:"%Y-%m-%d" }}

Countdown to events

{% assign event_timestamp = '2025-12-31' | date: "%s" %}
{% assign now_timestamp = 'now' | date: "%s" %}
{% assign days_left = (event_timestamp | minus: now_timestamp) | divided_by: 86400 %}
{{ days_left }} days remaining!

Numeric calculations and formatting

Perform math or format numbers dynamically.

Simple calculation

{{ 15 | divided_by: 2.0 }} → 7.5

Fallback values

{{ user.points | default: 0 }}

Language and locale

Adjust messages based on a user’s language or location.

{% if user.language == 'es' %}
¡Hola! Descubre nuestras ofertas.
{% else %}
Hello! Check out our offers.
{% endif %}

Best practices

While creating your messages with liquid tags, ensure you follow these best practices.

  • Always test your Liquid templates to ensure logic works across channels.

  • Use fallback values to prevent empty content.

  • Leverage reusable blocks for repeated patterns.

  • Keep Liquid syntax human-readable for easy maintenance.