Template Tags and Variables¶
The Hello Retail Triggered Email templates use the open-source template language Liquid. You can find the Liquid reference here and, if you are new to Liquid, a Liquid for Designers guide here.
This article lists the variables available in Triggered Email templates.
The product tag and its variables¶
The product tag represents a product. It exposes fields such as the product title and price, along with other attributes. Available variables:
titlepriceurlimgUrlisOnSaleoldPricecurrencyinStockbrand
Note
oldPrice is available only when isOnSale is true.
Example:
<div>
<h3>{{ product.title }}</h3>
<img src="{{ product.imgUrl }}" /><br/>
<span style="color:green;">{{ product.price }} {{ product.currency }}</span><br/>
<div class="button"><a href="{{ product.url }}">Buy now!</a></div>
</div>
Note
Additional product attributes may be available depending on your setup and product feed. Go to Data Setup > Inventory to see the attributes available on your products.
The products loop¶
The products variable contains the list of products provided by the trigger. Loop over it to render each product. Inside the loop, each product exposes the fields listed above.
Example:
{% for product in products %}
<div>
<h3>{{ product.title }}</h3>
<img src="{{ product.imgUrl }}" /><br/>
<span style="color:green;">{{ product.price }} {{ product.currency }}</span><br/>
<div class="button"><a href="{{ product.url }}">Buy now!</a></div>
</div>
{% endfor %}
Additional variables available¶
firstProduct¶
The firstProduct variable returns the first product in products.
Use it in subject lines or opening paragraphs.
Example:
mostPopularProduct¶
The mostPopularProduct variable returns the most popular product in the products list.
Useful for subject lines and key highlights.
Example:
Ups, you just left {{ mostPopularProduct.title }}
{% if products.size > 1 %}
and {{ products.size|minus:1 }} more things behind you...
{% endif %}
mostExpensiveProduct¶
The mostExpensiveProduct variable returns the most expensive product in the products list.
Use it for subject lines or lead content.
Example:
relatedProducts¶
When available, the relatedProducts variable is a list of related product objects.
Note
relatedProducts is available only on the Price drop and Back in stock triggers.
Example:
{% if relatedProducts %}
<h1>Related products</h1>
{% for product in relatedProducts %}
<div>
<h3>{{ product.title }}</h3>
<img src="{{ product.imgUrl }}" /><br/>
<span style="color:green;">{{ product.price }} {{ product.currency }}</span><br/>
<div class="button"><a href="{{ product.url }}">Buy now!</a></div>
</div>
{% endfor %}
{% endif %}
unsubscribe_url¶
The unsubscribe_url variable contains the system-generated unsubscribe link for the recipient.
Example:
cart_total¶
The cart_total variable can be used on Abandoned Cart triggers when cart data is available.
Example:
cart_url¶
The cart_url variable can be used on Abandoned Cart triggers when a recovery URL is available.
Example: