Using template variables in workflow messages

Use template variables to customize your workflow messages to include references to actual customers, orders, and products involved in your workflows. For example, if you cancel an order, you can send a message that includes the order number. When you edit a message action, there are Add template variable links available underneath the text boxes which support template variables.

Template variables in Shopify Flow are roughly equivalent to the same named attributes of the Shopify Liquid objects. But don't worry, you don't need to know Liquid in order to use them. We mention this relationship to help those who are familiar with Shopify Liquid.

The list of supported template variables is available when you edit a message action. In the message editor, click Add template variable to see the template variables that are filtered for your workflow:
A close-up of the workflow builder that shows the Send email action with the Add template variable link.

Template variables are place holders that are replaced with actual values when a workfow runs. These variables describe the attributes of the customers, orders, and products that are involved in your workflows. For example, there are template variables for the order number, order price, customer name, and so. Template variables begin with {{ and end with }}, and most of their names are self-describing. For example, the template variable that displays the name of the customer is {{customer.displayName}}.

Adding template variables to a message in your workflows is easy. You just position your cursor where you want the template variable to appear, and then you choose the variable from an available list.

To add a template variable to a message

  1. Create a workflow, and then add a Send email message, Send Slack message, or Send HTTP request action.

  2. Enter your message in a text box. For example, The following customer is now a VIP customer:
    Close up of text in a Message text box.
  3. Click Add template variable and select a template variable from the list:
    Close up of the Add template variable window.
    The template variable appears in the text box:
    Message that includes a template variable.
  4. Click Save.

  5. Click Preview to see an example of what your message will look like when the text variable is replaced during your workflow:
    Preview your workflow.

Customer template variables

The following list contains the template variables related to customers:

  • Accepts marketing - Shows True when the customer has agreed to accept marketing materials. Otherwise shows False.
  • Average order amount - Shows the average amount ordered.
  • Can delete
  • Display name
  • Email
  • First name
  • Has note
  • Has timeline comment
  • ID
  • Last name
  • Lifetime duration
  • Note
  • Phone
  • State
  • Tax exempt
  • Total spent
  • Verified email
  • Default address address 1
  • Default address address 2
  • Default address city
  • Default address company
  • Default address country
  • Default address country code
  • Default address first name
  • Default address formatted area
  • Default address last name
  • Default address latitude
  • Default address longitude
  • Default address name
  • Default address phone
  • Default address province
  • Default address province code
  • Default address zip
  • Image alt text
  • Last order billing address matches shipping address
  • Last order buyer accepts marketing
  • Last order can mark as paid
  • Last order cancel reason
  • Last order capturable
  • Last order cart discount amount
  • Last order closed
  • Last order confirmed
  • Last order currency code
  • Last order customer locale
  • Last order discount code
  • Last order display financial status
  • Last order email
  • Last order fulfillable
  • Last order fully paid
  • Last order has timeline comment
  • Last order landing page display text
  • Last order name
  • Last order net payment
  • Last order phone
  • Last order referral code
  • Last order referrer display text
  • Last order refundable
  • Last order requires shipping
  • Last order risk level
  • Last order subtotal price
  • Last order taxes included
  • Last order test
  • Last order total capturable
  • Last order total discounts
  • Last order total price
  • Last order total received
  • Last order total refunded
  • Last order total shipping price
  • Last order total tax
  • Last order unpaid

Order template variables

The following list contains the template variables related to orders:

  • Billing address matches shipping address
  • Buyer accepts marketing
  • Can mark as paid
  • Cancel reason
  • Capturable
  • Cart discount amount
  • Closed
  • Confirmed
  • Currency code
  • Customer locale
  • Discount code
  • Display financial status
  • Email
  • Fulfillable
  • Fully paid
  • Has timeline comment
  • ID
  • Landing page display text
  • Name
  • Net payment
  • Note
  • Phone
  • Referral code
  • Referrer display text
  • Refundable
  • Requires shipping
  • Risk level
  • Subtotal price
  • Taxes included
  • Test
  • Total capturable
  • Total discounts
  • Total price
  • Total received
  • Total refunded
  • Total shipping price
  • Total tax
  • Unpaid
  • Billing address address 1
  • Billing address address 2
  • Billing address city
  • Billing address company
  • Billing address country
  • Billing address country code
  • Billing address first name
  • Billing address formatted area
  • Billing address last name
  • Billing address latitude
  • Billing address longitude
  • Billing address name
  • Billing address phone
  • Billing address province
  • Billing address province code
  • Billing address zip
  • Channel handle
  • Channel name
  • Customer accepts marketing
  • Customer average order amount
  • Customer can delete
  • Customer display name
  • Customer email
  • Customer first name
  • Customer has note
  • Customer has timeline comment
  • Customer last name
  • Customer lifetime duration
  • Customer note
  • Customer phone
  • Customer state
  • Customer tax exempt
  • Customer total spent
  • Customer verified email
  • Customer journey customer order index
  • Customer journey days to conversion
  • Display address address 1
  • Display address address 2
  • Display address city
  • Display address company
  • Display address country
  • Display address country code
  • Display address first name
  • Display address formatted area
  • Display address last name
  • Display address latitude
  • Display address longitude
  • Display address name
  • Display address phone
  • Display address province
  • Display address province code
  • Display address zip
  • Marketing attribution campaign
  • Marketing attribution content
  • Marketing attribution medium
  • Marketing attribution source
  • Marketing attribution term
  • Physical location is primary
  • Physical location name
  • Shipping address address 1
  • Shipping address address 2
  • Shipping address city
  • Shipping address company
  • Shipping address country
  • Shipping address country code
  • Shipping address first name
  • Shipping address formatted area
  • Shipping address last name
  • Shipping address latitude
  • Shipping address longitude
  • Shipping address name
  • Shipping address phone
  • Shipping address province
  • Shipping address province code
  • Shipping address zip
  • Shipping line custom
  • Shipping line price
  • Shipping line shipping rate handle
  • Shipping line title
  • Suggested refund amount
  • Suggested refund maximum refundable
  • Suggested refund subtotal
  • Suggested refund total taxes

Product template variables

The following list contains the template variables related to products:

  • Available product count
  • Description
  • Handle
  • Has only default variant
  • Has out of stock variants
  • ID
  • Is gift card
  • Product type
  • Publication count
  • Template suffix
  • Title
  • Total variants
  • Tracks inventory
  • Vendor
  • Feedback summary

Product variant template variables

The following list contains the template variables related to product variants:

  • Available for sale
  • Barcode
  • Compare at price
  • Harmonized system code
  • ID
  • Inventory management
  • Inventory policy
  • Inventory quantity
  • Inventory quantity prior
  • Position
  • Price
  • Requires shipping
  • SKU
  • Taxable
  • Title - The
  • Weight
  • Weight unit
  • Fulfillment service handle
  • Fulfillment service inventory management
  • Fulfillment service inventory management
  • Fulfillment service product based
  • Fulfillment service service name
  • Image alt text
  • Product available publication count
  • Product description
  • Product handle
  • Product has only default variant
  • Product has out of stock variants
  • Product is gift card
  • Product product type
  • Product publication count
  • Product template suffix
  • Product title
  • Product total inventory
  • Product total variants
  • Product tracks inventory
  • Product vendor

Store

The following list contains the template variables related to your store:

  • Channel count
  • Checkout API supported
  • Currency code
  • Customer accounts
  • Description
  • Email
  • IANA timezone
  • Myshopify domain
  • Name
  • Pending order count
  • Setup required
  • Tax shipping
  • Taxes included
  • Weight unit
  • Billing address address 1
  • Billing address address 2
  • Billing address city
  • Billing address company
  • Billing address country
  • Billing address country code
  • Billing address first name
  • Billing address formatted area
  • Billing address last name
  • Billing address latitude
  • Billing address longitude
  • Billing address name
  • Billing address phone
  • Billing address province
  • Billing address province code
  • Billing address zip
  • Features financial reports: Internal use only. Do not use
  • Features harmonized system code: Whether to display Harmonized System codes on products. Used for customs when shipping cross-border.
  • Features shopify Plus: Whether the store is on a Shopify Plus plan.
  • Features show metrics: Whether to show metrics. Metrics are hidden for new merchants until they become meaningful.
  • Features storefront
  • Primary domain host
  • Primary domain SSL enabled

Examples

The following list contains examples of messages that use template variables:

  • In the following example, the title of the discontinued product will appear in the message:

    Discontinued product {{product.title}} has just hit an inventory level of 0.

  • In the following example, the title of variant will appear in the message:

    Please pause ad campaigns involving {{product_variant.title}}.

  • In the following example, the total price of the order as well as the customer's name will appear in the model:

    A new Canadian order has been created with a total value of {{order.totalPrice}} . Please contact {{order.customer.firstName}} to initiate the onboarding process.

  • In the following example, the customer's name and email address along with the total of their last order will appear in the message:

    Please send a personal thank you note template to {{order.customer.firstName}}({{order.customer.email}}) for placing a recent order for {{order.totalPrice}}

  • In the following example, the title of the product will appear in the message:

    Please reorder {{product.title}}. Email owner@store.com with purchase order when completed to verify.

  • In the following example, the order ID will appear in the message:

    {{order.id}} has been cancelled due to high risk.

  • In the following example, the order number and the customer's name and email address will appear in the message:

    Our Shopify store has received an order with a high risk of fraud. We would like to cancel this order right away, before it is sent to production:

    {{order.name}} {{order.billingAddress.lastName}} {{order.billingAddress.firstName}} {{order.email}}

    Please confirm the new order status. Thanks!

  • In the following example, the name of the customer, their email address, and the total price of their last order will appear in the message along with a link to the order in your Shopify admin:

    Please send personal thank you note template to {{order.customer.firstName}} ({{order.customer.email}}) for placing a recent order for {{order.totalPrice}} View order: https://store.myshopify.com/admin/orders/{{order.id}}

Want to discuss this page?

Visit the Shopify Community

Ready to start selling online with Shopify?

Try it free