Open navigation

How to restrict search to a category?

Yes, it is possible.

In our javascript we have a variable called klevu_category. Before our javascript fires a query to our servers to obtain search results, it checks if the klevu_category variable is initialised. If so, the value of this variable is used as a category filter.

If you have a dropdown where you allow your customers to choose a category, we suggest that whenever your customer is choosing a category or changing his/her selection of the category, you change the value of the the klevu_category variable. The value should be the name of the category. If no category is selected, please assign an empty string to the klevu_category variable.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.