Email template variables and filters

Template variables

The email template uses the Liquid templating language. 

The email template has the following Liquid objects available:

  • product - the product for the customer notification
  • variant - the specific product variant the customer requested the notification for
  • shop - your shop, including useful attributes such as shop.name and shop.email
  • customer - the customer the notification is being delivered to

Most of the popular Shopify Liquid filters have been made available for you to use in the customer email template. If you find a filter is missing please   contact support to see if it can be added.

If you're unfamiliar with Liquid templates take a look at  Shopify's Liquid introduction to learn the basics.

Shop

name

The name of shop.

email

The account owner email address for the shop.

address

The first line of the shop address.

city

The city for the shop address.

zip

The zip or postal code for the shop address.

country

The country for the shop address.

phone

The telephone number for the shop.

province

The state or province for the shop address.

owner

The name of the shop account owner.

domain

The domain name for the shop.

Product

id

Returns the product id used in the store catalog.

title

Returns the product title.

handle

Returns the handle used in the product page URL.

content

Returns the HTML content for the product description. Identical to product.description.

description

Returns the HTML content for the product description.

vendor

Return the product vendor.

type

Returns the type of product.

variants

Returns a list of variants for the product. See variants below for more information.

images

Returns a list of images for the product.

featured_image

Returns the featured image, or first image for the product.

tags

Returns a list of product tags.

price

Returns the price for the product.

options

Returns a list of option names for the product.

Variant

id

Returns the variant's unique catalog id.           

option1             

Returns the variant's first option.

option2             

Returns the variant's second option.

option3             

Returns the variant's third option.

price               

Returns the variant's price.

compare_at_price    

Returns the variant's compare at price.

weight              

Returns the variant's weight.

image

Returns the variant image if one has been set. Use the url property to include the image URL in your template.

{{ variant.image.url }}

To ensure an image is shown you can default to a product image if the variant image is blank:

{% assign featured_image = product.featured_image %}
{% if variant.image %}
  {% assign featured_image = variant.image %}
{% endif %}
<img src="{{ featured_image.url }}">
inventory_quantity

Returns the current inventory quantity for a variant.

sku

Returns the SKU for the variant.

title

Returns the variant title.

title_unless_default

Returns the variant title if set to something other than 'Default Title'. Otherwise it returns nothing.

This is useful when including a product and variant title, but you want to avoid single variant products being displayed as 'Default Title'.

/* Multi variant product, and variant title is 'Red' */
{{ product.title }} {{ variant.title_unless_default }} # Output: Shoes Red
/* Single variant product, and variant title is 'Default Title' so will be omitted */
{{ product.title }} {{ variant.title_unless_default }} # Output: Handbag
url

Returns a  full URL to the product page, with the variant parameter and UTM parameters embedded. This is the easiest way to link to a product in your email template.

{{ variant.url}}
# Output: https://www.myshop.com/products/shoes?utm_source=back-in-stock&utm_medium=email&utm_campaign=stock-notification&utm_content=ProductTitle&bis_id=*|BISID|*&variant=665433569

If you would like to override the default UTM parameters you can construct a URL and include the analytics filter. See analytics filter below.

add_to_cart_url

Returns a URL that will take the customer to the cart page with the variant added to the cart. This reduces the steps required for the customer to select a variant and click 'add to cart'.

{{ variant.add_to_cart_url }}
# Output: 
https://www.myshop.com/cart/12345678:1?utm_source=back-in-stock&utm_medium=email&utm_campaign=*|UTMCAMPAIGN|*&utm_content=*|UTMCONTENT|*&bis_id=*|BISID|*

Customer

email

The email address for the customer receiving the Back in Stock notification.

Template Filters

The standard Liquid filters are available for use. You can find a list of these in the Liquid  Standard Filters documentation. The following filters are available in addition to the standard filters.

asset_url

Returns a URL for an file stored in the store's assets folder.

{{ 'logo.png' | asset_url }}
product_img_url

Takes a product image and returns a URL to that image. Accepts a Shopify image size name as a parameter.

{{ product.featured_image | product_img_url: "medium" }}

Available sizes are master, 2048x2048, 1024x1024, grande, large, medium, compact, small, thumb, icon, and pico.

analytics

Appends UTM parameters to a URL. This is normally used to construct a product URL.

http://{{shop.domain}}/products/{{ product.handle | analytics }}
# Output:
# http://acmestore.com/products/red-shoes??utm_source=back-in-stock&utm_medium=email&utm_campaign=stock-notification&utm_content=ProductTitle&bis_id=ABC

UTM parameters are useful for tracking click throughs and conversions in tools such as Google Analytics.

url_escape

Replaces characters not allowed in a URL with their escaped variants. Useful for creating links which include a product title that may contain whitespace.

http://{{shop.domain}}/?ref={{ product.title | escape_url }}
# Output:
# http://acmestore.com/?ref=My%20escaped%20product%20title

Still need help? Contact Us Contact Us