> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.devit.software/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Fetch: process orders, products and customers in bulk

# ${color}[#204a87](Fetch: process orders, products and customers in bulk)

${color}[#3465a4](**In this article:**)
* [What Fetch does](#1-what-fetch-does)
* [Where you can use Fetch](#1-where-you-can-use-fetch)
* [Set up a Fetch step](#1-set-up-a-fetch-step)
* [Filter the items with a query](#1-filter-the-items-with-a-query)
* [Use the fetched item in actions](#1-use-the-fetched-item-in-actions)
* [Runs and limits](#1-runs-and-limits)
* [Check the result](#1-check-the-result)

Fetch takes a list of items from your store, such as all orders from last week or all products with a certain tag, and runs your actions for each of them. There is no fixed limit on how many records it processes: you decide with a filter and an optional maximum.

# ${color}[#204a87](What Fetch does)

A Fetch step gets items from your store and passes them to the next steps one by one. React Flow has a Fetch for each main resource:

* **Fetch collections**
* **Fetch customers**
* **Fetch draft orders**
* **Fetch metaobjects**
* **Fetch orders**
* **Fetch products**

Each fetched item goes through the steps under **for each** separately, as its own run.

# ${color}[#204a87](Where you can use Fetch)

* **In a** [**One-Shot workflow**](https://help.devit.software/en/article/one-shot-workflows-run-a-workflow-manually-15m0ibz/), as the starting point. You run it manually, for example to tag all old products once.
* **In an Automated workflow**, as an action. For example, a [Scheduled time](https://help.devit.software/en/article/scheduled-triggers-in-react-flow-6rhsni/) trigger runs every day and fetches the customers who haven't ordered in 90 days.

In an Automated workflow, the Fetch step has two outputs:

* **for each**: the steps here run once for every fetched item.
* **then**: the steps here run once, after the loop, to continue the main workflow.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/fetch-customers-segments_f7xarg.png =800x382)


# ${color}[#204a87](Set up a Fetch step)

1. In an Automated workflow, click **+** after the trigger, select **Action** and choose a Fetch action under **Fetch resources**. In a One-Shot workflow, choose the resource under **Fetch resources**.
2. Set **Sort data by**, for example **Last order date** and **Newest to oldest** for customers.
3. Set **Maximum number of ...** if you want to limit how many items are processed. Leave it empty to process all matching items.
4. Under **Select a query option to filter data**, choose a filter (see below).
5. Click **+** next to **for each**, and add the actions for each item.
6. Click **Save**.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/fetch-products-settings_1f0ta4s.png =800x382)


|| Processing a large store can take a while, even if you set a low maximum. React Flow processes the items in the background, so the results appear gradually.

# ${color}[#204a87](Filter the items with a query)

Click **Select a query option** and choose a ready-made filter. Examples:

* Products: **Created in the last week**, **Active products**, **Products by tag**, **Out of stock somewhere**.
* Customers: **Customers with a specified tag**, **Customers who have spent more than specified amount**, **Customers with more than ten orders**, **Customers with a specific metafield value**.

After you choose a filter, the query appears under **Edit query**. Change the values to your own, for example replace `tag:test` with `tag:summer`. The query uses the Shopify search syntax. Choose **Advanced** to write a query from scratch.

You can find more details on building an advanced query from scratch in the article [Fetch query: choose exactly which items your workflow processes](https://help.devit.software/en/article/fetch-query-choose-exactly-which-items-your-workflow-processes-16310c8/).

For customers, you can switch between two query types:

* **GraphQL**: the Shopify customer search syntax, for example `tag:VIP`.
* **Segments**: the Shopify customer segmentation syntax. You can also pick one of your saved segments. Example: `number_of_orders >= 1 AND last_order_date < -90d`.

Click **Test** next to **Edit query** to see the list of items that match. The **Runs counter** updates as you change the filter.

# ${color}[#204a87](Use the fetched item in actions)

Inside **for each**, the current item is available as a "Loop" variable. Click **Add variables** in any field and open the group, for example **Loop customer**. The variables look like this:

* `{{ loop.customer.firstName }}`
* `{{ loop.customer.defaultEmailAddress.emailAddress }}`
* `{{ loop.customer.lastOrder.createdAt }}`

Shopify actions inside the loop, such as **Add customer tags**, work on the fetched item.

||| A Fetch step can't be placed inside another **for each** step. Nested fetches are not supported.

# ${color}[#204a87](Runs and limits)

Each fetched item counts as a separate workflow run. If a workflow fetches 500 customers, it uses 500 runs, plus one for the trigger.

* Check the **Runs counter** before you save or run the workflow. It shows how many items the current query will fetch.
* Use a precise query and **Maximum number** to process only the items you really need.
* Before a One-Shot Fetch starts, the **Runs limit** window shows the number of runs and asks you to confirm.

Runs above your monthly plan limit are charged at your plan's rate. If you often process large lists, the **Unlimited** plan avoids overage charges.

# ${color}[#204a87](Check the result)

Open the run on the **Activity** page. The **For each** section shows the Fetch step, how many items were processed (for example "4 successes / 4 resources"), and the sort, limit and query that were used.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/activity-fetch-run_oci2.png =800x125)


# ✔️ Next step

Check our articles to learn more about the app's functionality:

* [Fetch query: choose exactly which items your workflow processes](https://help.devit.software/en/article/fetch-query-choose-exactly-which-items-your-workflow-processes-16310c8/)
* [Scheduled triggers in React Flow](https://help.devit.software/en/article/scheduled-triggers-in-react-flow-6rhsni/)
* [How runs are counted in React Flow](https://help.devit.software/en/article/how-runs-are-counted-in-react-flow-k7214w/)
* [Activity page](https://help.devit.software/en/article/activity-page-17bwxxd/)