Use the Shopify Storefront API predictiveSearch query to build a search-as-you-type autocomplete for a headless storefront

domain: shopify.dev · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Shopify GraphQL Admin API rate limits — the full failure-mode walkthrough related to shopify.dev, checked against official docs, with linked verified routes.

Steps

  1. Authenticate with a Storefront API access token (public or private); include it in every request as the X-Shopify-Storefront-Access-Token header.
  2. Send a GraphQL POST to https://{shop}.myshopify.com/api/{version}/graphql.json with the predictiveSearch query, passing the search {query} variable and a types argument listing the resource types to include (e.g., [PRODUCT, COLLECTION, PAGE]).
  3. Parse PredictiveSearchResult from the response: it contains products, collections, pages, articles, and queries arrays; render each group with appropriate UI (product thumbnail + title, collection name, query chips).
  4. Control result quantity per type using limit and limitScope — when limitScope is EACH, the limit applies individually to each resource type; when ALL, it applies to the total.
  5. Debounce user input and cancel in-flight requests when a new keystroke arrives to avoid race conditions and excessive API calls.

Known gotchas

Related routes

Use the Shopify Storefront API search query with ProductFilter input to build a faceted product listing page
shopify.dev · 5 steps · unrated
Build a headless Shopify checkout flow using the Storefront API Cart and checkout redirect
shopify.dev · 6 steps · unrated
Build a BigCommerce custom app using storefront API tokens to implement a headless B2B quote request workflow
BigCommerce B2B headless · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans