Skip to main content
Liquid: add text before the variable

With this manipulation, you add text before a variable so that only matching profiles see this text.

Francine avatar
Written by Francine
Updated over 10 months ago

The prepend function allows you to add some text if the variable does not exist or is not applicable. For example, "I hope you are happy with your {{ last_ordered_product_name }}". Profiles that haven't ordered anything will only see the "We hope you're happy with your ." part in this. This, of course, seems odd.

To solve this, you can add text before a variable:

{{ last_ordered_product_name | prepend: "We hope you're happy with your" }}

When a profile receives the e-mail and he has never bought anything, he will not see this whole line. If a profile did buy something, he will see, "We hope you are happy with your [product name]."

Did this answer your question?