> ## 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 query: choose exactly which items your workflow processes

# ${color}[#204a87](Fetch query: choose exactly which items your workflow processes)

${color}[#3465a4](**In this article:**)
* [Why the query matters](#1-why-the-query-matters)
* [Where to write the query](#1-where-to-write-the-query)
* [Query syntax basics](#1-query-syntax-basics)
* [Product query examples](#1-product-query-examples)
* [Filter products by metafields](#1-filter-products-by-metafields)
* [Use dynamic dates with Liquid](#1-use-dynamic-dates-with-liquid)
* [Order query examples](#1-order-query-examples)
* [Queries for other Fetch resources](#1-queries-for-other-fetch-resources)

Every [Fetch](https://help.devit.software/en/article/fetch-process-orders-products-and-customers-in-bulk-19y81zq/) step (Fetch products, orders, customers, collections, draft orders, metaobjects) has a query. The query decides which items the workflow gets from your store. This article explains how to write one, with examples you can copy.

# ${color}[#204a87](Why the query matters)

The query is the most important setting of a Fetch step:

* **It decides what your actions change.** Every fetched item goes through the steps under **for each**. A wrong or empty query means your actions (add tags, update prices, send emails) run on items you didn't plan to change.
* **It decides how many runs you use.** Each fetched item counts as a separate workflow run. A query that returns 30 products uses 30 runs. Without a query, the step fetches all products in the store.
* **It makes scheduled workflows dynamic.** With a date in the query, a daily workflow processes only that day's items, for example products that launch today.

|| Always check the Runs counter after you change the query. If it shows the same number as your whole store, the filter is probably not working.

# ${color}[#204a87](Where to write the query)

1. Open a Fetch step (a Fetch resource in a [One-Shot workflow](https://help.devit.software/en/article/one-shot-workflows-run-a-workflow-manually-15m0ibz/), or a Fetch action in an Automated workflow).
2. Under **Select a query option to filter data**, choose a ready-made filter, such as **Products by tag**, or choose **Advanced** to write your own query.
3. Change or type the query in **Edit query**.
4. Check the **Runs counter** at the top of the panel. It shows how many items match the query, for example "The selected query will fetch **2 products**".

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


|| The ready-made filters are good starting points. Pick the closest one and change its values in **Edit query**, instead of writing the query from scratch.

# ${color}[#204a87](Query syntax basics)

The query uses the [Shopify API search syntax](https://shopify.dev/docs/api/usage/search-syntax): `filter:value`.

* `tag:summer` matches items with the tag "summer".
* Use quotes for values with spaces or special characters: `vendor:'Snow Peak'`.
* Combine filters with `AND` and `OR`: `status:active AND tag:summer`.
* Exclude with `-` or `NOT`: `-tag:archived`.
* Compare numbers and dates with `>`, `<`, `>=` and `<=`: `price:>100`.
* Use `*` to match any value: `metafields.custom.launch_date:*` matches products where the metafield is filled in.
* Text values are case-sensitive. `metafields.custom.swatch_enabled:'yes'` doesn't find products where the value is `Yes`.

The filters you can use depend on the resource. The full list for each one is on shopify.dev (see the links in the sections below).

# ${color}[#204a87](Product query examples)

The full list of product filters: [Shopify Admin API: products query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/products#arguments-query).

| Goal | Query |
| ---- | ---- |
| Products with a tag | `tag:summer` |
| Products without a tag | `tag_not:summer` |
| Active products only | `status:active` |
| Products of a type | `product_type:snowboard` |
| Products from one of two vendors | `vendor:Snowdevil OR vendor:Icedevil` |
| Products with a variant priced over 500 | `price:>500` |
| Products with no stock | `inventory_total:0` |
| Products created after a date | `created_at:>'2026-01-01'` |
| Active products with the tag "sale" | `status:active AND tag:sale` |

|| Use the filter names from the **Admin API** list. Filters that exist only in the Storefront API (for example `available_for_sale` or `variants.price`) don't work in a Fetch step. With them, the **Runs counter** can't calculate a number.

# ${color}[#204a87](Filter products by metafields)

You can filter by any product metafield with `metafields.{namespace}.{key}:{value}`. Examples:

* `metafields.custom.swatch_enabled:'Yes'`: products where the "Swatch Enabled" choice list is set to **Yes**.
* `metafields.custom.launch_date:'2026-11-01'`: products that launch on November 1.
* `metafields.custom.launch_date:<='2026-11-01'`: products that launched on or before November 1.
* `-metafields.custom.swatch_enabled:'Yes'`: all products where swatches aren't enabled.

|| To filter products by a metafield, make sure filtering is enabled for it in your Shopify settings first. If filtering is off, Shopify ignores the metafield part of the query and the Fetch step gets **all** products. Your actions then run on every product in the store.

To turn on filtering:

1. In your Shopify admin, go to **Settings** > **Metafields and metaobjects** > **Products**.
2. Open the metafield definition, for example **Swatch Enabled**. The text under **Name** (for example `custom.swatch_enabled`) is the `namespace.key` to use in the query.
3. Under **Options**, turn on **Filter on the product list and in the Admin API**.
4. Click **Save**.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/metafield-swatch-enabled-filte_kfgqx1.png =800x982)


The option's name depends on the metafield type. For a **Date** metafield, such as **Launch Date**, it's called **Filter products in the Admin API**.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/metafield-launch-date-filter_100tx3g.png =800x800)


After you turn on filtering, open the Fetch step again and check the **Runs counter**. It should now show only the matching products.

|| Shopify supports metafield filters for **products**, **orders** and **metaobjects**. It doesn't support them for customers, collections or draft orders. You can filter by most metafield types, but not by JSON or rich text. Learn more: [Shopify: query using metafields](https://shopify.dev/docs/apps/build/metafields/query-using-metafields).

# ${color}[#204a87](Use dynamic dates with Liquid)

A fixed date like `'2026-11-01'` works only once. To get "today" every time the workflow runs, put Liquid in the query. React Flow replaces it with the real date before it fetches the items.

Products whose **Launch Date** is today:

`metafields.custom.launch_date:'{{ "now" | date: "%Y-%m-%d" }}'`

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


Put this query in a Fetch products action after a daily [Scheduled time](https://help.devit.software/en/article/scheduled-triggers-in-react-flow-6rhsni/) trigger. Each day, the workflow then processes only the products that launch that day, for example to publish them or add a "new-arrival" tag.

More examples:

* Products that have already launched: `metafields.custom.launch_date:<='{{ "now" | date: "%Y-%m-%d" }}'`
* Products created in the last 7 days: `created_at:>='{{ "now" | date: "%Y-%m-%dT%H:%M:%SZ", 0 | dateSubtract: 7, "day" }}'`

The ready-made "Created in the last..." filters use the same Liquid. Choose one of them to see an example you can change.

# ${color}[#204a87](Order query examples)

The full list of order filters: [Shopify Admin API: orders query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/orders#arguments-query).

Ready-made filters for **Fetch orders** include **Created in the last day**, **Unfulfilled orders**, **Partially fulfilled orders**, **Unfulfilled orders older than two days**, **Chargebacks**, **Paid orders from the last week** and **Pending orders from the last week**.

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


| Goal | Query |
| ---- | ---- |
| Paid orders that aren't shipped yet | `financial_status:paid AND fulfillment_status:unshipped` |
| Open unfulfilled orders | `fulfillment_status:unshipped AND status:open` |
| Orders over 500 | `current_total_price:>500` |
| Orders with a tag | `tag:wholesale` |
| Orders without a tag | `tag_not:exported` |
| Orders that used a discount code | `discount_code:SUMMER10` |
| Orders with a high fraud risk | `risk_level:high` |

Orders with dynamic dates:

* Orders from the last 30 days: `created_at:>='{{ "now" | date: "%Y-%m-%dT%H:%M:%SZ", 0 | dateSubtract: 30, "day" }}'`
* Unfulfilled orders older than 2 days that aren't cancelled: `created_at:<='{{ "now" | date: "%Y-%m-%dT%H:%M:%SZ", 0 | dateSubtract: 2, "day" }}' AND fulfillment_status:unshipped AND NOT status:cancelled`

Orders also support metafield filters, for example `metafields.custom.gift_wrap:true`. As with products, turn on filtering for the order metafield definition first (**Settings** > **Metafields and metaobjects** > **Orders**).

# ${color}[#204a87](Queries for other Fetch resources)

All Fetch resources in React Flow support a query, ready-made filters and the **Advanced** option. The filters you can use for each one are listed on shopify.dev:

* **Fetch products**: [products query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/products#arguments-query)
* **Fetch orders**: [orders query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/orders#arguments-query)
* **Fetch customers**: [customers query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/customers#arguments-query). Example: `tag:VIP`. In **Segments** mode, use the [Shopify customer segmentation syntax](https://help.shopify.com/en/manual/customers/customer-segmentation/customer-segmentation-editor) instead, for example `number_of_orders >= 1 AND last_order_date < -90d`.
* **Fetch collections**: [collections query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/collections#arguments-query). Example: `collection_type:smart`.
* **Fetch draft orders**: [draft orders query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/draftOrders#arguments-query). Example: `status:open AND tag:wholesale`.
* **Fetch metaobjects**: [metaobjects query arguments](https://shopify.dev/docs/api/admin-graphql/latest/queries/metaobjects#arguments-query). Filter by a field with `fields.{key}:{value}`, for example `fields.on_sale:true`.

# ✔️ Next step

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

* [Fetch: process orders, products and customers in bulk](https://help.devit.software/en/article/fetch-process-orders-products-and-customers-in-bulk-19y81zq/)
* [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/)
* [React Flow recipes: Liquid in emails, HTTP request bodies, tags from metafields and win-back](https://help.devit.software/en/article/react-flow-recipes-liquid-in-emails-http-request-bodies-tags-from-metafields-and-win-back-p3tash/)