Schedules, get data, and looping workflows in Shopify Flow
In most cases, you can build a workflow by linking together multiple conditions and actions to a trigger that runs when an event happens. For more complex use cases, you might find that no trigger exists for what you need to do, you need it to run at a certain time, or you might need to work with a list of data. In these cases, you can use scheduled time triggers, get data actions, and loops to create advanced workflows.
As an example, suppose that you want to get a daily summary of unfulfilled orders. With this group of features, you can run a workflow that runs every day at a certain time, that gets those orders, and then sends you a summary of them. You can explore more examples and templates that make use of these triggers and actions.
On this page
Scheduled time trigger
Instead of starting a workflow because of an event, the Scheduled time trigger starts a workflow at a specific time and date that you specify. You can also schedule the workflow to recur hourly, daily, weekly, or monthly. As a result of running from a schedule, to use data such as customers, orders, or products, you have to use an action to get that data. You can do this by using Get data actions.
The Scheduled time trigger can run as frequently as every 10 minutes.
Get data actions
Most actions change something in your store, for example, adding tags to a customer, or sending a command to an app, such as instructing an app to send a push notification to a customer.
Get data actions fetch data from your store for use in Flow. These actions call a query with a set of filters, such as getting only something updated in the last day. The action returns a list of data that match that data. For example, the Get order data action calls the Order query on the Admin API and returns a list of orders that match your query.
Get data actions can only run on lists up to 100 items long.
The following actions retrieve information from your store so that you can use that data in your workflow. Consult each action for details on how to filter data and what data is returned:
- Get cash tracking session data
- Get collection data
- Get company data
- Get company location data
- Get customer data
- Get discount data
- Get draft order data
- Get fulfillment order data
- Get gift card data
- Get location data
- Get metaobject entries
- Get metaobject entry
- Get order data
- Get product data
- Get product variant data
- Get selling plan group data
- Get subscription billing attempt data
- Get subscription contract data
Liquid tags in Get data actions
When using a Get data action with dates, you can use the date_minus and date_plus Liquid tags to change dates in your query. For example, to calculate a date 5 days before the scheduled run time of a workflow, you can use the following Liquid:
{{ scheduledAt | date_minus: "5 days" }}For more details about how to use these tags, refer to the Liquid variables documentation.
For each loops
When you use a Get data action, you get a list of data that matches your query. You can use the For each loop (iterate) action to loop through that list. In a For each loop, you can use conditions and actions that apply to just that item.
For example, you create a workflow that runs every Monday. The workflow uses the Get order data action to retrieve orders placed during that week. The For each loop (iterate) then applies a New order tag to each order returned by the getOrderData list. After all of the orders in the list are tagged, an internal email is sent indicating that tagging is complete.

Aggregation actions
When working with lists, you might want to count the number of items to use in later Conditions and Actions. For example, you might want check if there are more than 0 results before sending an email. Flow provides these actions to perform calculations on list data in a workflow:
Examples of advanced workflows in Shopify Flow
Review some examples of advanced workflows that you can use in Shopify Flow:
- Get a daily summary of orders that miss a two-day fulfillment window.
- When a new order is created, check if the same customer placed other orders within the last 24 hours.
- Every day, get a summary email listing products that are out of stock.
- Once a day, find all orders associated with a chargeback and tag the customer.
- When a new order is created, find out how many orders the customer has made in the last six months.
- Every day, get a list of all open draft orders and send a Slack message.
Get a daily summary of orders that miss a two-day fulfillment window
This workflow can be used to determine if any orders have missed a shipping guarantee period, and if so, how much those orders are worth.
In this example, the workflow runs every day at 5:00 pm. The workflow uses the Get order data action to retrieve a list of orders that weren't fulfilled within a two-day shipping window. Then, the For each action adds a tag to all late orders. The workflow also uses the Count action to determine the number of late orders and the Sum action to determine the value of those orders. The variables that are created by the Count and Sum actions are used to send an email to indicate the number of orders and their value.

Install this workflow template in your store.
When a new order is created, check if the same customer placed other orders within the last 24 hours
This workflow can be used to determine if the same customer has placed multiple orders in the same day, and if so, puts a hold on fulfillment so that the orders can be shipped together.
In this example, the workflow runs every time a new order is created. The workflow uses the Get order data action to retrieve a list of orders that were placed by the customer in the last day. Then, the Count action determines the amount of orders that the customer has placed. If there are two or more orders placed by the same customer in the same day, then the fulfillment of the orders is placed on hold and tags are added to the orders.

Install this workflow template in your store.
Every day, get a summary email listing products that are out of stock
This workflow can be used to generate a list of all your out of stock products and send an email.
In this example, the workflow runs every day at 9:00 pm. The workflow uses the Get product data action to retrieve a list of products that have no inventory. The Count action determines the number of out of stock items. The variables that are created by the Get order data and Count actions are used to send an email to indicate the number of products and a list of those products.

Install this workflow template in your store.
Once a day, find all orders associated with a chargeback and tag the customer
This workflow can be used to track customers that have initiated a chargeback.
In this example, the workflow runs every day at 10:00 am. The workflow uses the Get order data action to retrieve a list of orders that that have chargebacks. Then, the For each action adds a tag to all customers that placed those orders.

Install this workflow template in your store.
When a new order is created, find out how many orders the customer has made in the last six months
This workflow can be used to determine how many orders a customer has placed in the last six months and add loyalty tags.
In this example, the workflow runs every time a new order is created. The workflow uses the Get order data action to retrieve a list of orders that were placed by the customer in the last six months. Then, the Count action determines the number of orders that the customer has placed, and the Sum action determines the value of those orders. A customer tag is added if the amount of orders is equal to or greater than five, and another tag is added if the value of the orders is equal to or greater than $100.

Install this workflow template in your store.
Every day, get a list of all open draft orders and send a Slack message
This workflow can be used to send a Slack message that indicates if there are any open draft orders in your store, and if so, how many.
In this example, the workflow runs every day at 5:00 pm. The workflow uses the Get draft order data action to retrieve a list of draft orders that have the Open status. Then, the Count action determines the number of open draft orders. The variable that is created by the Count actions is used to send a Slack message to indicate the number of open draft orders.
