Workflow examples

Learn about the types of workflows that you can create by reviewing some examples.

Risk

You can use Flow to notify you when you receive a high-risk order. In your workflow, use the Order risk analyzed trigger to check the risk level of an order. This trigger uses the results from the Shopify Risk Analysis only (results from third-party apps are not used).

When you receive a high-risk order, you can choose to have Flow do the following tasks:

  • Tag the order so that it can be processed later. You can use Flow to notify your staff or to send the order details to an app.

  • Prevent the payment from being processed (as long as your store is set up to capture payments manually).

  • Cancel the order (as long as the order is set up to be fulfilled manually).

If your store is set up to manually capture payments, then you can use Flow to prevent capturing the payment for high-risk orders. Create a workflow that checks the order's risk level and only capture payment when the risk is low or medium. In your workflow, use the Capture payment action to capture the payment.

Use the Order Risk Level condition to check an order's risk level

If your store is set up to automatically capture payments, then you can use Flow to cancel the order (you can't prevent the payment from being captured in this case). Your store also can't be set up to automatically fulfill orders. In your workflow, use the Cancel order action to cancel the order. When you use this action, the order is cancelled, but it isn't refunded and by default the ordered items are restocked:

  • Flow doesn't refund orders. After Flow cancels an order, you need to manually refund it.
  • By default, Flow doesn't restock items. It is assumed that when you refund the order, you'll also restock the items. When you manually refund an order, the default is to restock the items. This process is easy to follow, but it means that your inventory isn't updated until you refund the orders. If your inventory needs to be updated faster, then you can have Flow restock the items when it cancels the order. If you choose this option, then you need to remember to deselect the restock items option when you refund the order. Otherwise, the items will be restocked twice and your inventory numbers won't be correct.

You can also cancel orders based on other criteria, such as the email or IP address of the customer.

To keep track of orders that Flow cancels, you can add actions that do the following activities:

  • Tag the cancelled orders.
  • Send a message or log the issue to an app, such as Google Sheets or Trello.

Template examples:

Inventory and merchandising

Flow can help you tag products when they are out of stock and when they are restocked. You can then use the tags to control how these products appear to your customers:

In your workflow, use the Inventory quantity changed trigger to create a workflow that tracks inventory changes. This trigger needs to check the following conditions:

  • Product variant inventory quantity
  • Product variant inventory quantity prior - Use this condition to make sure that your workflow runs only the first time that the inventory matches the Product variant inventory quantity condition. If you don't use the quantity prior condition, then your workflow could run more often than expected.

For example, to be notified when a variant's inventory is less than 5, set Product variant inventory quantity to 5 and set Product variant inventory quantity prior to >5. When you create this type of workflow, the condition needs to check both the amounts before and after the inventory changes. If you check only the current inventory amount, then your reorder email could be sent each time the product is ordered until the product is restocked. For example, there are 7 T-shirts in your store and Jose orders 2 T-shirts. The inventory is now 5, so a reorder email is sent. Later, Karim orders 1 T-shirt. The inventory is now 4, but no reorder email is sent.

To be notified when a variant's inventory is more than 100, set Product variant inventory quantity to >100 and set Product variant inventory quantity prior to <100.

Template examples:

Loyalty and promotions

You can use Flow to track discount codes and to reward your customers for their support. Many popular loyalty apps have Flow connectors that you can use to reward your customers based on their spending and activity in your store. For example, you can give a customer loyalty points for ordering a specific product, creating a positive review, and so on.

Template examples:

Customers

You can have Flow add tags to your customers when the customer is created, when they create an order, or when you cancel their order. You can tag customers based on their characteristics, such as their postal code, email address, and their order history.

Organize customers by lifetime spend tiers

Template examples:

You can also tag customers based on the characteristics of their current order, such as its total amount and the sales channel used.

Template examples:

Orders

When an order is created or refunded, you can have Flow tag the order and notify your staff or send details to an app. In your workflow, you can create conditions based on the characteristics of the order or the customer who made the order.

Template examples:

If you automatically fulfill your orders, then you can also have Flow archive those orders.

Products

When you create a product, you can have Flow tag the product and add it to manual collections. For example, when a new product's title contains the word T-shirt, Flow can add a T-shirt product tag and then add the product to your Summer collection. In your workflow, use the Tag product and Add to collection actions to add tags to your products.

Templates:

Template variables and Liquid examples

Examples of workflow actions that use template and Liquid variables.

  • For example, you have a workflow that sends an email when a customer spends more than $500 on an order.
To Joe@mycompany.com

Please send a personal thank you note to {{order.customer.firstName}} {{order.customer.lastName}}({{order.customer.email}}) for placing an order for  {{order.totalPriceSet.shopMoney.amount}}

When a customer, Jeanne Dupont, creates an order for $1000, the following message is sent by the workflow:

Joe@mycompany.com

Please send a personal thank you note to Jeanne Dupont (jeanne@jeanneemail.com) for placing an order for $1000.00
  • In the following example, the title of the discontinued product appears in the message:
Discontinued product {{product.title}} has just hit an inventory level of 0.
  • In the following example, the title of variant appears in the message:
Please pause all ad campaigns involving {{product_variant.title}}.
  • In the following example, the customer's name and email address along with the total of their last order appears in the message:
Please send a personal thank you note to {{order.customer.firstName}}({{order.customer.email}}) for placing a recent order for  {{order.totalPriceSet.shopMoney.amount}}
  • In the following example, the title of the product appears in the message:
Please reorder {{product.title}}. Email owner@store.com to verify that they've received the purchase order.
  • In the following example, the order ID appears 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 appears 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 appears in the message along with a link to the order in your Shopify admin:
Please send a personal thank you note to
{{order.customer.firstName}} ({{order.customer.email}}) for placing a recent order for $ {{order.totalPriceSet.shopMoney.amount}}

View order: https://store.myshopify.com/admin/orders/{{order.id}}

For Loop examples

When an offer is received, it can be useful to send a message that contains the products ordered. You can do this by using for loops and the lineItems template variable.

Text fields that support template variables also support for loops and the forloop object.

Here's an example that uses a for loop to list the SKUs and quantities in all the lineitems:

Order summary:
{% for a in order.lineItems %}
  SKU: {{a.sku}} ( {{a.quantity}} ), 
{% endfor %}

When the message is sent, the for loop code is replaced with the list of SKUs:

Order summary:
  8987097979 (50)
  8877778887 (3)
  888998898B (1)

In this example, the for loop is used to list all the lineitems:

Order summary: <br />
{% for a in order.lineItems %}
Title: {{a.title}}, <br/>
SKU: {{a.sku}}, <br/>
Price (per unit): $ {{a.originalUnitPriceSet.shopMoney.amount}}, <br/>
Quantity: {{a.quantity}} <br/>
{% endfor %} 
Ship to: <br/>
{{order.shippingAddress.name}}  <br/>
{{order.shippingAddress.address1}}  <br/>
{{order.shippingAddress.address2}}  <br/>
{{order.shippingAddress.city}}  <br/>
{{order.shippingAddress.province}}  <br/>
{{order.shippingAddress.zip}}  <br/>
{{order.shippingAddress.country}}  <br/>

In this example, an if is used inside the for loop to list lineitems from a specific vendor:

{% for x in order.lineItems %}
{% if x.vendor == 'acme-vendor' %}
  Title is {{x.title}}<br/>
  SKU is {{x.sku}}</br>
{% endif %}
{% endfor %}

In addition to the examples on this page, you can also find workflows in the following ways:

Ready to start selling with Shopify?

Try it free