Recapture's Quick Guide to LiquidJS in Emails
What is Liquid?
Liquid is a simple, friendly way to make your emails personal. Instead of writing one fixed email that's the same for everyone, you leave little "blanks" in your text — and Liquid fills them in with the right details for each customer when the email goes out.
Think of it like a mail-merge in a word processor: you write Hi [first name] once, and each person receives it with their own name. Liquid works the same way, just with a bit more flexibility — it can also show or hide whole sections depending on the situation.
It was originally created by Shopify and is now used all over the web. The best part: you don't need to be technical to use it. If you can write an email, you can use Liquid.
How it works
Liquid lets you drop personalized, dynamic content into your emails — like a customer's name or whether to show a certain message. You write little "placeholders" in your email, and when the email is sent, they get filled in with real values.
There are two kinds of placeholders:
{{ ... }}(double curly braces) — shows a value in the email.{% ... %}(curly brace + percent) — does something, like checking a condition. These don't show anything themselves.
That's the whole idea. Here's what you'll use most.
Good to know: the exact fields you can use depend on which kind of email you're sending (abandoned cart, post-purchase, broadcast, and so on). The examples below use abandoned-cart fields like
cart.first_name. You can find the full list for each email type in the Recapture supported tags guide.
1. Show a variable
Wrap a variable name in {{ }} to insert its value.
Hi {{ cart.first_name }},
Thanks for shopping with us!
If cart.first_name is Sarah , this becomes:
Hi Sarah, Thanks for shopping with us!
2. Show a variable, with a fallback
Sometimes a value might be missing — maybe you don't have the customer's first name. Add | default: "..." to provide backup text so the email never looks broken.
Hi {{ cart.first_name | default: "there" }},
- If
cart.first_nameisSarah→Hi Sarah, - If
cart.first_nameis empty →Hi there,
The text inside the quotes is whatever you want to show when the value is missing.
3. Show something only if a condition is true
Use an if block to include content only in certain cases. It always starts with {% if ... %} and ends with {% endif %} .
{% if discount %}
Use code {{ discount }} for a special discount on your order!
{% endif %}
If there's a discount code, the line shows. If not, it's skipped entirely — no empty space, no broken sentence.
Adding an "otherwise"
You can show alternative text with {% else %} :
{% if cart.first_name %}
Hi {{ cart.first_name }}, welcome back!
{% else %}
Hi there, welcome back!
{% endif %}
This greets the customer by name when you have it, and falls back to a friendly generic greeting when you don't.
Bonus: tidy up your text
A few small "filters" can clean up how a value looks. You add them after a variable with a | .
{{ cart.first_name | capitalize }} → turns "sarah" into "Sarah"
{{ discount | upcase }} → turns "save10" into "SAVE10"
You can even combine a filter with a default:
Hi {{ cart.first_name | default: "friend" | capitalize }},
A couple of tips
- Spelling matters. Variable names must match exactly —
cart.first_nameis not the same ascart.firstnameorCart.First_Name. - Check the field list for your email type. Not every field works in every email — see the supported tags guide.
- When in doubt, send yourself a test email to see how the placeholders fill in with real data.
That's everything you need for great personalized emails.