Skip to main content
Product search against the Shopify Storefront API with debounced typing, persisted history, autocomplete suggestions and the original imperative call kept for back-compat.
Typing debounces into one Storefront request; an empty query clears the results without a request. Unlike listing hooks, nothing is fetched on mount.

Hook API

History and suggestions

  • History is persisted through the SDK’s storage, capped at 20, trimmed and de-duplicated case-insensitively. Adding an existing term moves it to the front instead of duplicating it.
  • Suggestions combine the query against history, the current result page’s titles, vendors and tags. Vendors/tags are emitted as vendor:<name> and tag:<name> so tapping one runs a valid Storefront search.
  • With availableSuggestionsOptions, only the supplied sources are used.
  • Suggestions are capped at 10 unique values and computed locally — no network request.

Legacy imperative call (deprecated)

Existing screens keep working unchanged:
search() bypasses the debounce, forces a network read and pins the page size. New code should use setQuery + results.

Structured filters

collection:, vendor: and tag: are the Storefront search prefixes. Metafields are not queryable through search; the metafield field is accepted for shape parity but ignored — filter those results client-side.

Query scope

SEARCH_PRODUCTS searches product title, description, tags, productType and vendor. Each result node includes id, title, handle, description, vendor, tags, availableForSale, priceRange, images(first: 1) and variants(first: 1).