Skip to main content

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​

PropertyTypeDescription
predictiveSearchResultObject \| undefinedThe predictive search results object containing queries, collections, and products arrays.