How to use Variables

Variables are representations of data. When a workflow runs, variables are replaced with real data.

In this example, the Send an SMS message to your customer when their order is delivered template has been installed to the MESA dashboard.

In the SMS Send Message step, you can see that the Retrieve Order > Customer > Phone variable is used. This will be replaced with your customer's phone number when the workflow runs.

This variable came from the Variables menu by clicking the {+} icon in the To phone number field. The menu will display on the right-hand side.

In the search field, you can search for "Phone" to find the Customer Phone variable. 

The Shopify Retrieve Order step will contain data about the order including your customer's phone number. Select the Phone variable under the Retrieve Order > Customer > label from the Shopify Retrieve Order step.

When this workflow runs, the order that triggered it will determine the phone number to send the text to. For example, if we received an order from John Smith (123-456-7890), the workflow will send the text message to 123-456-7890 when their order is delivered.

Advanced usage

Using global store settings

Use the {{context.shop.PARAMETER}} variables to pull in settings from your Shopify store. Some common variables:

  • {{context.shop.email}}: Your store's contact email. Set in the General page of your Shopify settings.
  • {{context.shop.domain}}: Your store's url. Example: www.mystore.com if you have a custom domain, mystore.myshopify.com if you have not configured a custom domain.
  • {{context.shop.myshopify_domain}}: Your .myshopify.com domain. Example: mystore.myshopify.com.
  • {{context.shop.name}}: Your store's name. Example: My Store.

Formatting tags with Liquid

Variables are parsed similarly to Shopify's Liquid syntax. This can be useful when you wish to manipulate data before it's processed.

In this example, we replace all tags that contain 'Spring Range' with 'Summer Range'.

1. Select the variable for the product tags.

2. Double click on the variable to edit it.

3. Insert the replace filter to replace all tags that contain 'Spring Range' with 'Summer Range'.

To learn more about Liquid syntax and its many functions, check out Shopify's Liquid documentation.

Dates and Times

You can get information about the current date and time by using the {{date:<format>}} variable. For example, if the day of the week today is Tuesday, the variable {{date:D}} will return "Tue". Full details and examples can be found in the Working with Dates guide.

Additionally, you can format the "Created At" variable to only display the date by using the following variable: {{shopify_order.created_at | slice: 0, 10}}