Template Tags and Variables

Template Tags and Variables

  • updated 2 yrs ago

The Hello Retail Triggered email templates are based on the open-source template language called Liquid. You can find a great reference for Liquid here and if you are new to Liquid, you can find a great resource for designers here.

In this article, you'll find an overview of the variables available in the Triggered email templates.

The product tag and it's variables

The product tag is a representation of a product. On a product, stuff like the product title and price are available among other variables. Here's the complete list of variables available:

  • title
  • price
  • url
  • imgUrl
  • isOnSale
  • oldPrice (Note: only available if isOnSale is true)
  • currency
  • inStock
  • brand

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 More variables on product level can be available - depending on your setup. If you navigate to Data Setup > Inventory. Here you'll find a list of all the available attributes on your products.

   

The products loop

The products variable is the main variable containing the list of products to loop over, for you to display. Inside this loop, you have access to the product with the details specified 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 is simply a shortcut returning one and the first product available.

This can be great to use in subject lines and opening paragraphs in your Triggered emails.

Example:

{{ firstProduct.title }} among other products just dropped in price

mostPopularProduct

The mostPopularProduct variable is a shortcut to the most popular product available in the products list.

This variable can be used with great success in subject lines of your Triggered emails.

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 is a shortcut to the most expensive product available in the products list.

This can be great to use in subject lines and opening paragraphs in your Triggered emails.

Example:

{{ mostExpensiveProduct.title }} are now back in stock at only {{ mostExpensiveProduct.price }}

relatedProducts

If available, the relatedProducts variable is a list of products.

Note This variable is only available 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 is a variable containing your unique system URL for users to click if they wish to unsubscribe.

Example:

<a href="{{ unsubscribe_url }}">Click here to unsubscribe!</a>

cart_total

The cart_total variable can be used on Abandoned cart triggers, if available.

Example:

{% if cart_total %}
<strong>Total: {{ cart_total }}</strong>
{% endif %}

cart_url

The cart_url variable can be used on Abandoned cart triggers, if available.

Example:

{% if cart_url %}
<div class="button"><a href="{{ cart_url }}">Recover my cart</a>
{% endif %}
Like Follow
  • 2 yrs agoLast active
  • 821Views
  • 1 Following