Skip to main content
Sometimes one email needs to change shape: show a section to some recipients, swap one offer for another, or list a different number of points each time. You do this with two kinds of Liquid instructions, if and for. You write them in the email’s design, between the placeholders you already use. For the placeholders themselves, see Personalizing an email. For ready-made snippets, see Liquid recipes.

Show a section to some recipients only

Wrap the section in if and endif. Recipients who don’t match never see it, and you don’t need to do anything else.
Your condition can test any merge field, such as person.title, person.companyName, or person.lifecycleStage.

Switch between two versions

Add else to show something different to everyone who doesn’t match.
If you leave else out, everyone else sees nothing.

Repeat a list

To show a different number of bullet points each time, use for over a copy field whose type is array.
You add as many points as you need when you write the email, and the list in the design grows or shrinks to match. Your template’s copy schema must declare points as an array.

Run a promotion for a limited time

Compare today’s date to an end date you keep in a copy field. allGood works out the email when it sends, so a nurture email that goes out over many months picks the right version each time.
Write the end date as year-month-day, such as 2026-12-01, so the comparison orders correctly. Because the date sits in the copy, you can change it without editing the design.
  • The date is fixed when the email sends. A recipient who opens it a week later still sees the version that was live when it sent. If the end date matters, state it in the email.
  • Time zones: the send time is likely in UTC, so the cutoff can shift by up to a day for some of your recipients.
  • Preview shows today. To check the after-the-date version, move the end date back for a moment.
  • Review perennial emails. Once a promotion ends, your email shows the fallback or nothing. Note the end date where reviewers will see it.

What can go wrong

  • A misspelled field counts as empty. {% if person.titel == "VP" %} quietly means false for everyone. Preview the email as a real person who should match.
  • Keep required footer items outside conditions. Your unsubscribe link and postal address must appear in every recipient’s message. See Before an email can send.
  • Wrap whole sections. Put a condition around an entire mj-section, not around one mj-column of a multi-column section.
  • One bad render stops the whole send. If your email fails to render for one recipient, the whole send fails. Before you publish, preview it as someone with blank fields.
  • Only standard Liquid works. There are no custom filters.