Liquid allows us to access data from your store, like product titles and prices, and output it directly into an email template. It uses a special language to 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.

For instance, you may have noticed the following bit of code in a few of your emails:

{{customer.first_name}} 

This is a piece of Liquid (or Liquid magic, as we like to call it). It tells the email template to grab the first name of your customer from your shop's database and include it in the email.

We can take it 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 in the database:

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.first_name == "Houdini" %}Hey Houdini, sounds like you might like magic as much as we do :){% else %}Hey{{customer.first_name | there}}, thanks for stopping by!{% endif %}  

 
Now if a customer named 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 :)

Did this answer your question?