useSearchResult
This hook retrieves the predictive search results stored in page state. Use it to display search result suggestions (queries, collections, products) from the predictive search feature.
Import
import { useSearchResult } from '@appmaker-xyz/shopify';
Basic Usage
const { predictiveSearchResult } = useSearchResult();
// Access search result sections
const queries = predictiveSearchResult?.queries;
const products = predictiveSearchResult?.products;
const collections = predictiveSearchResult?.collections;
Return Value
| Property | Type | Description |
|---|---|---|
predictiveSearchResult | Object \| undefined | The predictive search results object containing queries, collections, and products arrays. |