Skip to main content

{{Snippets.greetings}} with a liquid fallback saves you from failed messages


Hey Community!

I wanted to share a tip that saves a lot of time for me. I used to get a lot of of failed messages with the reason “customer.first_name is missing”.

I know that there’s a liquid fallback but I don’t speak Liquid language fluently and always forget to put the fallback in place.

{{snippets.greetings}} is a game changer.

 

What you need to do is to create a snippet with the fallback as the value:

Hi {% if customer.first_name != blank %}{{customer.first_name}}{% else %}there{% endif %},

 

Snippet

 

 

In the emails, instead of remembering to type the fallback every time, you will just use

{{snippets.greetings}}!

 

 

3 replies

  • Scholar
  • 3 replies
  • August 22, 2022

This is cool! I’m also not great with liquid so only having to actually type the longer logic out once and then use the snippet makes me feel a lot more confident that I’ll have consistency in my messages. 

Thanks for sharing! 


  • Novice
  • 8 replies
  • August 24, 2022

Thank you for sharing Chloe! That’s super useful!


Felix
  • Novice
  • 223 replies
  • February 27, 2023

hey Chloe,

like your post! I was confronted with the fact that in some languages there are specifc ways to use formal as well infomal greetings. I created some liquid that solves this issue.

The last version is in German, because there is no such a version in the English language.

 

Formal - No Salutation (Gender neutral)

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

Note: When translating "dear customer" can be changed to the local gender neutral expression, e.g. in German "lieb:r Kund:in".

 

Formal - Salutation (Fallback gender neutral)

Hello {% if customer.gender == "female" %}{% if customer.last_name %}Mrs. {{customer.last_name}}{% else %}dear customer{% endif %}{% elsif customer.gender == "male" %}{% if customer.last_name %}Mr. {{customer.last_name}}{% else %}dear customer{% endif %}{% else %}{% if customer.first_name %}{% if customer.last_name %}{{customer.first_name}} {{customer.last_name}}{% else %}dear customer{% endif %}{% else %}dear customer{% endif %}{% endif %},

Note: When translating "dear customer" can be changed to the local gender neutral expression, e.g. in German "lieb:r Kund:in".

Note: The attribute "gender" can also be replaced by "salutation".

 

Informal - No Salutation (Gender neutral) 

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

 

Informal - Salutation (Fallback gender neutral)

Hallo {% if customer.gender == "female" %}{% if customer.first_name %}liebe {{customer.first_name}}{% else %}liebe Kundin{% endif %}{% elsif customer.gender == "male" %}{% if customer.first_name %}lieber {{customer.first_name}}{% else %}lieber Kunde{% endif %}{% elsif customer.first_name %}lieb:r {{customer.first_name}}{% else %}lieb:r Kund:in{% endif %},

Note: You can replace the German words with any other lnaguage. Here is an explanation of the words in English:

  • Hallo = Hello
  • liebe = dear (female)
  • lieber = dear (male)
  • Kundin = customer (female)
  • Kunde = customer (male)
  • liebe:r Kund:in = gender neutral version of “dear customer”

 

 


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