For each
TheFor eachaction performs an action on every item in a list, when that action is connected to theDo this for each itemoption. This action functions on lists, such as line items in an order or in workflows that retrieve data by using one of the following actions:
After you add theFor eachaction, select either or both of the following options:
- ClickThento add a single action or a condition. This action is taken after all the actions performed byDo this for each itemare complete.
- ClickDo this for each itemto add an action to perform on every entry in the list returned by aGetaction.
For example, you create a workflow that runs once a week. The workflow uses theGet order dataaction to retrieve orders placed during that week and applies a tag to each one. After all the tags are applied, an email is sent indicating that tagging is complete.
On this page
Considerations for using the For each action
Review the following considerations before you use theFor eachaction:
- The list that you use in theFor eachaction can't have more than 100 items. If the selected list has more than 100 items, then the workflow fails and all actions following theFor eachaction are not taken.
- The following actions can't followDo this for each item:
- AnotherFor eachaction
- TheWaitaction
- TheGet collection dataaction
- TheGet customer dataaction
- TheGet draft order dataaction
- TheGet order dataaction
- TheGet product dataaction
Only one condition or action can immediately followDo this for each item. You can add multiple additional conditions after this, but each option can only lead to a single condition or action.
For example, you create a workflow that uses theFor eachaction. You clickDo this for each itemand add a condition. In this condition, and in every condition following it, only one action or condition can be added to either theThenorOtherwiseoptions.
Fields
TheFor eachaction contains the following fields.
Field | Description |
---|---|
List | Required. The list of items to perform an action on. This can be a list returned by aGetaction or a list returned by a trigger, such as a list of line items returned by theOrder createdtrigger. |
Triggers
TheFor eachaction can be used in any workflow.
Monitoring workflows
After a workflow has run, you can审查其体育rformanceon the Shopify FlowActivitypage. The following is true for workflows that contain aFor eachaction:
- TheStatusandActionsections apply to all the actions taken by theFor eachaction.
- TheRun detailssection, including the preview of the workflow, apply only to the last action that theFor eachaction has taken.
Example
In this example workflow, a list of unfulfilled orders is retrieved every day at 5:00 pm. TheExpedite shipping
tag is added to every order in the list.