Articles on: React Flow

Fetch query: choose exactly which items your workflow processes

Fetch query: choose exactly which items your workflow processes


In this article:


Every Fetch 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.


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.


Where to write the query


  1. Open a Fetch step (a Fetch resource in a One-Shot workflow, 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".




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.


Query syntax basics


The query uses the Shopify API 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).


Product query examples


The full list of product filters: Shopify Admin API: products query arguments.


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.


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.




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.




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.


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" }}'




Put this query in a Fetch products action after a daily Scheduled time 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.


Order query examples


The full list of order filters: Shopify Admin API: orders query arguments.


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.




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).


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:



✔️ Next step


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


Updated on: 20/10/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!