Skip to main content

useSearch

This hook manages the search query state and provides the search result count on the search page.

Import

import { useSearch } from '@appmaker-xyz/shopify';

Basic Usage

const { query, setQuery, suggestLoading, searchResultCount } = useSearch();

// Update the search query
setQuery('sneakers');

Return Value

PropertyTypeDescription
querystringThe current search query string.
setQueryFunctionUpdates the search query in page state. Signature: setQuery(query).
suggestLoadingbooleanWhether search suggestions are loading.
searchResultCountnumberTotal count of products matching the search query.