Liquid codes are used to display dynamic content in emails, such as a customer's name. Liquid codes can be added to any text field (subject line, preview text, headings, rich text, etc.).
Liquid codes can be added manually or through the Personalization tool.
Insert a liquid code with the personalization tool
Add a first name, last name, email, or discount code with the personalization tool. The personalization tool is located next to all eligible text fields in the Editor.
Each liquid tag offers the option for Fallback text. If the customer has not provided the information, the fallback text will show in replace of the variable.
For example:
You updated your subject line to "Hey {{ customer.first_name | default: there }}, thanks for signing up!". If your Shopify Customer data contains the first name, the subject line will read, "Hey Chris, thanks for signing up!" If your Shopify Customer data does not contain the first name, the subject line will read, "Hey there, thanks for signing up!"
To add a liquid tag with the personalization tool:
Click on the Personalization icon.
Select the customer information.
Optional: Add Fallback text.
Click Add
Note: The option to add a discount code will only display if a discount has been set for the newsletter or automation email.
Manually insert a liquid code
Manual liquid codes can be used to add alternative customer information.
To add a liquid code:
Add the syntax for liquid code snippet, {{ CODE | default: 'FALLBACK_TEXT' }}, to the text field.
Replace CODE with the customer information code.
Replace the 'FALLBACK_TEXT' with your preferred verbiage. The Fallback text will show in an email if the customer has not provided the information.
Codes and descriptions
Customer Information Code | Description |
customer.email | Customer's Email Address |
customer.first_name | Customer's First Name |
customer.last_name | Customer's Last Name |
customer.name | First and last name combined with a space in between |
customer.orders_count | Count of orders the subscriber made |
customer.id | Number found in the Shopify admin URL when viewing the customer record |
Syntax for liquid:
{{ CODE | default: 'FALLBACK_TEXT' }}
Example:
Dear {{ customer.first_name | default: 'valued customer' }},
With Subscriber First Name | Without Subscriber First Name |
Dear Chris, | Dear valued customer, |