This reference article lists all the variables that are available for Shopify transactional email templates.
To access the customer and order objects for your transactional email sends, you must use the {{ data }}
variable.
Use the correct building blocks in your transactional email campaign
When you are building your transactional email campaign, you must place all code in Text building blocks and not Liquid markup building blocks.
Subject line variables
You can't use most variables in your transactional email subject lines. However, there are four that you can use:
@FIRSTNAME@
@LASTNAME@
@ORDER_ID@
@ORDER_NUMBER@
Customer variables
You can use any available code for your account confirmation transactional email campaigns.
Customer data variables
The {{ data.customer }}
variables are:
Variable | Description of variable |
| Returns the ID of the customer. |
| Returns the email address of the customer. |
| Returns the first name of the customer. |
| Returns the last name of the customer. |
|
|
| Returns the date and time a customer was created. For example, |
| Return the date and time a customer was updated. For example, |
| Returns the company name that was left by the customer. |
| Returns the phone number of the customer. |
| Returns the number of total orders a customer has at the time. For example, |
| Returns any notes left by the customer. |
Customer billing address variables
The {{ data.customer.billing_address }}
variables are:
Variable | Description of variable |
| Returns the ID of the billing address. |
| Returns the address billing type. For example, |
| Returns the first name of the customer. |
| Returns the last name of the customer. |
| Returns the billing address post code. |
| Returns the first line of the billing address. |
| Returns the second line of the billing address. |
| Returns the phone number of the customer. |
| Returns the billing address city. |
| Returns an array of the billing address country. |
| Returns the billing address alpha-2 country code. For example, |
| Returns the billing address alpha-3 country code. For example, |
| Returns the billing address country name. For example, |
| Returns an array of the billing address state. |
| Returns the billing address state in code format. For example, |
| Returns the billing address state in code name format. For example, |
| Returns the company name. |
| Returns the default billing address. For example,
The default customer billing address attribute stores addresses that a customer enters where one is the default. |
Customer shipping address variables
The {{ data.customer.shipping_address }}
variables are:
Variable | Description of variable |
| Returns the customer shipping address ID. For example, |
| Returns the customer shipping address type. For example, |
| Returns the customer shipping address first name. |
| Returns the customer shipping address last name. |
| Returns the customer shipping address post code. |
| Returns the first line of the customer shipping address. |
| Returns the second line of the customer shipping address. |
| Returns the customer shipping phone number. |
| Returns the customer shipping address city. |
| Returns an array of the customer shipping address country. |
| Returns the customer shopping address country in version two format. For example, |
| Returns the customer shipping address country in version three format. For example, |
| Returns the customer shipping address country name. For example, |
| Returns an array of the customer shipping address state. |
| Returns the customer shipping address state in code format. For example, |
| Returns the customer shipping address state code name. For example, |
| Returns the customer company name that’s used for shipping details. |
| Returns the customer shipping address default option. For example, |
Order variables
You can use any of the available codes for your order confirmation and other order-related transactional email campaigns.
Order data variables
The {{ data.order }}
variables are:
Variable | Description of variable |
| Returns the order ID. |
| Returns the email address of the customer that places the order. |
| Returns the date and time the customer purchases an order. For example, |
| Returns the order subtotal. |
| Returns the order subtotal and includes the tax. |
| Returns any order discount amounts. |
| Returns the order total. |
| Returns the order payment method. For example, |
| Returns the order delivery method. For example, |
| Returns the order delivery total. |
| Returns the order currency. For example, |
| Returns the order status. For example, |
| Returns any order coupon codes that were used. |
| Returns the store name where the order was placed. |
| Returns the source where the order was placed. For example, |
| Returns the status of the order. For example, |
| Returns the status of the order payment. For example, |
Order billing address variables
The {{ data.order.billing_address }}
variables are:
Variable | Description of variable |
| Returns the order order billing address ID. |
| Returns the order type. For example, |
| Returns the first name that’s used for the billing address. |
| Returns the last name that’s used for the billing address. |
| Returns the post code that’s used for the billing address. |
| Returns the first line of the billing address. |
| Returns the second line of the billing address. |
| Returns the phone number. |
| Returns the billing address city. |
| Returns the billing address country. |
| Returns the billing address state code. For example, |
| Returns the billing address state name. For example, |
| Returns the company name. |
| Returns the fax number. |
| Returns the default billing address. For example,
The default order billing address attribute stores addresses that a customer enters where one is the default. |
| Returns the billing email address. |
Order delivery address variables
The {{ data.order.delivery_address }}
variables are:
Variable | Description of variable |
| Returns the delivery address. |
| Returns the delivery ID. |
| Returns the delivery type. For example, |
| Returns the first name. |
| Returns the last name. |
| Returns the delivery address post code. |
| Returns the first line of the delivery address. |
| Returns the second line of the delivery address. |
| Returns the phone number. |
| Returns the delivery address city. |
| Returns the delivery address country. For example, |
| Returns the deliver address state code. For example, |
| Returns the delivery address state name. For example, |
| Returns the company name. |
| Returns the fax number. |
| Returns the default order delivery address. For example,
The default order delivery address attribute stores addresses that a customer enters where one is the default. |
| Returns the email address. |
Order product variables
The {{ data.order.products }}
variables are:
Variable | Description of variable |
| Lists the line item products in the order as an array. |
| Returns the name of the products. |
| Returns the product unit price. |
| Returns the product unit price, including the tax. |
| Returns the product SKU. |
| Returns the quantity of product. |
| Returns the URL of the product page. |
| Returns the URL of the product image. |
You can use a combination of the above variables to create your transactional email template. Here is an example of what you can do:
Hi, {{ data.order.billing_address.first_name }}.
Thanks for your order {{ data.order.id }}!
Your order status is now: {{ data.order.order_status}}.
You've ordered the following products:
Items{% for product in data.order.products %}
{{product.name}}
({{product.sku}}) x
{{product.qty}}
Price:{{product.price_inc_tax}}------------------------------------
---------------------
{% endfor %}
Order shipment variables
Order shipment variables are available for shipping confirmation and shipping update emails. The {{ data.shipment }}
variables are:
Variable | Description of variable |
| Returns the shipping ID. |
| Returns the order ID. |
| Returns an array of all the tracking numbers available for this shipment. |
| Returns the ID of the carrier. For example, |
| Returns the shipment tracking number. |
| Returns the shipment tracking URL (carrier’s website). |
Using webhook raw data for Shopify
You can also use the full JSON data made available by Shopify in the associated webhooks that are used to trigger each transactional email. This data is available in the ##{{ data.raw }}
variable.
Learn more about what JSON data can be retrieved for each webhook in Shopify developer documentation.
There are different webhooks that are used for each template:
Transactional email template | Shopify webhook |
New account confirmation | customer/create |
New order confirmation | orders/create |
Shipping confirmation | fulfillments/create |
Shipping update | fulfillments/update |
Order cancelled | orders/cancelled |
Order refunded | refunds/create |
With webhooks, you can link to the secured order status page:
Click <a href="{{ data.raw.order_status_url }}"> here </a> to see your
order status.
You can also display the content of a shipment:
Your order has been partially shipped.
Here is the list of the items included in this shipment:
{% for line_item in data.raw.line_items %}
{{line_item.title}} (
{{line_item.sku}}) x
{{line_item.quantity}}
Price:{{line_item.price}}-----------------------------------------
----------------
{% endfor %}