Liquid allows us to access data from your store, like product titles and prices, and output it directly into an email template. This helps you dynamically change content, create rules and filters for how and when content should appear in emails, and even fallbacks for when we might not have any data.

ℹ️ Looking for a complete guide? See our full liquid resource here.

 What does liquid do?

You may have noticed the following bit of code in a few of your emails:

{{ customer.first_name }}

This is a piece of Liquid (basically, email black magic 😉). It tells Jilt to grab the first name of your customer and include it in the email.

We can take Liquid to the next level by using filters to modify the output. Let's set a fallback for when we don't have a customer's first name available:

Hey {{ customer.first_name | default: "there" }}!

Using the pipe (| ) symbol, we've told Jilt that we're using 'there' for an empty name field. That way, our greeting will be personalized if we have the customer's first name, or the email will say 'Hey there!' if we don't.

We can add logic as well, so that we have the freedom to exclude information in certain instances or output different chunks of content depending on a set of criteria.

Let's try it out:

{% if customer.last_name == "Houdini" %}
   Hey Houdini, sounds like you might like magic as much as we do :)
{% else %}
  Hey {{ customer.first_name | default: "there" }}, thanks for stopping by!
{% endif %}  

 Now if a customer named Harry Houdini receives an email, he'll have a unique greeting. All other customers will receive a different salutation. Abracadabra!

Interested in adding a bit of magic to your templates but don't know where to start? Get in touch and we'll grab our wand. 🙂🔮

Liquid Object Reference

Looking for a comprehensive reference to the Liquid Jilt supports? Check out our Jilt for developers site here.

Did this answer your question?