Skip to main content
Solved

Missing variables (liquids) in emails

  • September 28, 2023
  • 2 replies
  • 629 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. 

Best answer by Felix

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

View original
Did this topic help you find an answer to your question?

2 replies

Felix
  • Novice
  • 223 replies
  • Answer
  • September 28, 2023

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


  • Author
  • Novice
  • 1 reply
  • September 28, 2023

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

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings