Solved

Missing variables (liquids) in emails

  • 28 September 2023
  • 2 replies
  • 108 views

Hey. 

How can I make sure an email still delivers to a user even if a liquid or variable used in the email is empty or non existent for the recipient?

 

Like I would want the variable/liquid to be empty and the email should still get sent. 

icon

Best answer by Felix 28 September 2023, 18:54

View original

2 replies

Userlevel 4

Hey Gift,

the easiest way to do this is to use an if-statment. You can just leave the {% else %} part blank. Here is an example for a salutation:

Hello{% if customer.first_name %} {{customer.first_name}}{% else %}{% endif %},

 

Output first_name exisits:

Hello Felix,

Output first_name does not exist:

Hello,

 

Hope that helps,
Felix

Ouuh. I’ll try this! Thank you very much

 

Reply