state— aReadonlySignal<QueryState<T>>with{ data, error, isFetching }execute()— runs the query, returnsResult<T, ClientError>subscribe(callback)— reacts to state changes without importing signalsdispose()— cleans up subscriptions and aborts pending requests
client.collection() - Browse collections
Browse products in a collection with filters, sort, and pagination.
| Parameter | Type | Required | Description |
|---|---|---|---|
handle | string | Yes | Collection URL handle |
defaultSort | string | No | Default sort code (uses first configured sort) |
| Parameter | Type | Description |
|---|---|---|
page | number | Page number (default: 1) |
limit | number | Products per page (default: 24) |
sort | string | Sort option code |
filters | unknown | Filter criteria |
signal | AbortSignal | Per-call abort signal |
includeMeta | boolean | Include _meta in response |
linking | Record<string, unknown> | Dynamic linking parameters |
transformRequest | (body) => body | Custom request body transformation |
client.blocks() - Product recommendations
Product recommendations powered by Layers blocks. Anchored to a product, collection, or cart.
| Parameter | Type | Required | Description |
|---|---|---|---|
blockId | string | Yes | Layers block ID |
anchor | string | No | Anchor product/collection ID, Shopify GID, or handle |
| Parameter | Type | Description |
|---|---|---|
page | number | Page number (default: 1) |
limit | number | Products per page (default: 24) |
filters | unknown | Filter criteria |
signal | AbortSignal | Per-call abort signal |
discounts | DiscountEntitlement[] | Discount entitlements to apply |
context | BlocksContext | Cart, geo, and custom context |
linking | Record<string, unknown> | Dynamic linking parameters |
transformRequest | (body) => body | Custom request body transformation |
BlocksContext:
| Property | Type | Description |
|---|---|---|
productsInCart | { productId, variantId?, quantity? }[] | Products in the cart |
geo | { country?, province?, city? } | Geographic context |
custom | Record<string, unknown> | Custom context data |
client.search() - Full-text search
Full-text search with facets. Options persist across calls, so subsequent execute() calls merge with existing options.
| Parameter | Type | Description |
|---|---|---|
query | string | Search query |
page | number | Page number (default: 1) |
limit | number | Products per page (default: 24) |
filters | unknown | Filter criteria |
signal | AbortSignal | Per-call abort signal |
searchId | string | Cached search ID from prepare() |
temporary | boolean | Don’t persist params for next call |
linking | Record<string, unknown> | Dynamic linking parameters |
transformRequest | (body) => body | Custom request body transformation |
client.suggest() - Predictive search
Predictive search with debouncing and local caching. Only full words (trailing space) are cached. Partial input filters cached results client-side.
| Option | Type | Description |
|---|---|---|
debounce | number | Debounce delay in ms (default: 300) |
excludeInputQuery | boolean | Remove user’s input from suggestions |
excludeQueries | string[] | Custom strings to filter from suggestions |
signal | AbortSignal | Shared abort signal (acts like dispose()) |
client.uploadImage() - Upload image
Upload an image for image-based search.
client.searchByImage() - Search by image
Search products using an uploaded image.
| Parameter | Type | Required | Description |
|---|---|---|---|
imageId | string | Yes | Image ID from uploadImage() |
page | number | No | Page number (default: 1) |
limit | number | No | Products per page (default: 24) |
filters | unknown | No | Filter criteria |
signal | AbortSignal | No | External abort signal |
linking | Record<string, unknown> | No | Dynamic linking parameters |
transformRequest | (body) => body | No | Custom request body transformation |
client.searchContent() - Search articles and blog content
Search articles and blog content with pagination. Options persist across calls, so subsequent execute() calls merge with existing options.
| Parameter | Type | Description |
|---|---|---|
query | string | Search query (required) |
contentType | string | Filter by content type (e.g., ‘article’) |
page | number | Page number (default: 1) |
limit | number | Results per page (default: 24) |
signal | AbortSignal | Per-call abort signal |
transformRequest | (body) => body | Custom request body transformation |
temporary | boolean | Don’t persist params for next call |
Product card controller
Reactive controller for product cards with variant selection and availability logic. All derived values are computed signals that auto-update when inputs change.ReadonlySignal): variants, selectedVariant, options, images, price, priceRange, carouselPosition, isSelectionComplete.
Options include availability status baked in:
Abort signals
Controllers support two levels of abort:execute() starts.