productSearchSuggestions
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
| Argument | Type | Description |
|---|---|---|
term | String! | |
limit | Int! | Default 5 |
Returns
| Field | Type | Description |
|---|---|---|
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 } }}{ "term": "Example", "limit": 1}{ "data": { "productSearchSuggestions": { "terms": [ "Example" ], "categories": [ { "productCount": 1 } ], "products": [ { "id": "id-1", "availability": "IN_STOCK", "name": "Example", "description": "Example", "sku": "SKU-1", "ean": "Example", "mpn": "Example", "hscode": "Example", "unit": "Example", "kind": "PHYSICAL" } ] } }}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/commercetools | Resolved |
| @evolve-framework/medusa | Resolved |
| @evolve-framework/sfcc | Resolved |
Used by
The storefront packages that send it, in these GraphQL documents:
- @evolve-storefront/feature-product:
ProductSearchSuggestions

