Using Filters in E-mail Templates
In addition to conditions (such as if/else), you can also use "filters" in e-mail templates. Filters modify the variables/placeholders before they are placed in the email, for example, converting a name to UPPERCASE.
Using Filters
You use variables/placeholders in the templates with double curly braces, like this:
You add filters by placing a pipe after the variable and then the name of your filter. For example, in this case, the filter "upper":
This will convert the name "Amy Jacobs" to "AMY JACOBS".
Filter: upper
This filter converts the text you pass into uppercase letters:
This converts "Amy Jacobs" to "AMY JACOBS".
Filter: lower
This filter converts the text you pass into lowercase letters:
This converts "Amy Jacobs" to "amy jacobs".
Filter: length
This filter counts the number of characters in the text you pass:
This converts "Amy Jacobs" to "10".
Example
You can use this to display text if a variable is filled in. If it is filled, its length will be greater than 0.
Your order has been shipped with tracking code {{ shipment.trackingcode }}.
{% endif %}
Filter: url_escape
This filter modifies the text so that it can be used in URLs:
This converts "amy@example.org" to "amy%40example.org".
Example
You can use this to build a URL with variables from the order, while keeping the link clickable.