Skip to content

productSearchSuggestions

Queryin Catalog

Suggestions for a partly typed search term, for the panel under a search field: completions of the term, the categories holding the most matching products, and the best matching products. limit caps each group and is clamped to 10. A term shorter than 2 characters answers no suggestions.

Arguments

ArgumentTypeDescription
termString!
limitInt!Default 5

Returns

ProductSearchSuggestions!

FieldTypeDescription
terms[String!]!Completions of the term, each to be searched for as it stands. Empty where the engine offers none.
categories[ProductCategorySuggestion!]!The categories holding the most matching products, most first
products[ProductVariant!]!The best matching products, best first, each as the variant that matched: the one whose sku was typed, otherwise the variant a listing shows.

Example

query ProductSearchSuggestions($term: String!, $limit: Int!) {
productSearchSuggestions(term: $term, limit: $limit) {
terms
categories {
productCount
}
products {
id
availability
name
description
sku
ean
mpn
hscode
unit
kind
}
}
}

The query selects the return type's fields two levels deep; pick the ones you need. The response shows its shape with placeholder values.

Served by

@evolve-framework/commercetoolsResolved
@evolve-framework/medusaResolved
@evolve-framework/sfccResolved

Used by

The storefront packages that send it, in these GraphQL documents: