The useProductSearch hook supports filters.category: string[], but I don’t see any API or hook that returns available categories for the current shop.
How can I retrieve (or know) the list of categories to use in filters.category?
The useProductSearch hook supports filters.category: string[], but I don’t see any API or hook that returns available categories for the current shop.
How can I retrieve (or know) the list of categories to use in filters.category?
Hi @Anton_Omelianenko, 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"]
In the Search hook,category is an array of strings, so in the same query you could bring products from multiple categories