Skip to main content

useProductSearch

The useProductSearch hook fetches products based on a search query.

Note

In order to filter products by category, you can check Shopify’s Product Taxonomy. Then use the GID of the category. For example, to filter products in the Electronics category, you would use: ["gid://shopify/TaxonomyCategory/el"]

Anchor to params
params
required

Examples

tsx

import {useProductSearch} from '@shopify/shop-minis-react'

export default function MyComponent() {
const {products, loading} = useProductSearch({
query: 'shirt',
first: 10,
filters: {
color: ['RED'],
},
})

console.log({products, loading})
}

Was this page helpful?