Get 15% off Mageplaza extensions & subscriptions! Use code HIMAY at checkout.

How to add & configure Search by category in Magento 2

Vinh Jacker | 09-27-2019

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

If you have an online store with several products, there is a good chance your customers will want to search within specific categories and not others. Come with the solution for this problem, Magento 2 Ajax Search includes search by category feature helping your online store searchable by categories.

Are you finding a way to reduce customers’ efforts in product searching? Do you want to increase conversion rates and enhance the customer experience? Now more than ever, arrange your products in specific categories and extend the search functionality by allowing search by category. Follow this article, and you’ll find how to configure search by category function in your Magento 2 store.

Ajax Search

Search Extension for Magento 2

AJAX & Auto-complete search for up to 10,000 SKUs

Check it out!

Learn more: How to configure Search by SKU in Magento 2

What is Search by Category?

Search by Category

Search by category is the functionality in almost websites allowing you to search in a specific group of products instead of the whole site for quicker and more accurate results.

With search by category, customers will be able to narrow down the scale of products, then easy to find what they want. It is much better if they can control the results pool, particularly on a website with massive products.

Why online stores need Search by Category?

Improve user experience

Search by category is now essential to an e-commerce website. If your online store is well-structured by organizing products according to individual categories, customers will find their needed items more quickly and accurately. Especially for an e-commerce website with a wide variety of products, the search results page can be too long and difficult to identify same types of products from different brands or products with identical names but different functions. Specific categories will make it easier for visitors to narrow down the relevant search results and navigate their options.

Therefore, to configure search by category is an excellent way to improve the user experience on your website, then boost conversion rates. It is also better for you to track and manage the products according to specific categories.

Promotion tool

Online merchants often choose to configure Search by category in Magento as it is also a way to showcase available categories you have. Thanks to it, you are able to promote niche categories or recently released ones.

In addition, you can promote your best sellers by automatically showing 10 products right after shoppers click on the search field. You can also add other search phrases to easily advertise low-revenue items.

Better data collection

Data Collection

Besides, based on the search analysis on your store, you can quickly know which categories and products are in customers’ demand. It is useful for business and marketing strategies. Placing products into small groups is also a time-saving way to collect data related to products or from product search results.

In the end, search by category facilities helps you to deal with the question: “How to make your store’s massive products well-organized on the store as well as searchable for customers?”

How to configure Search by Category in Magento 2

With the information I mentioned above, you might have got a better understanding of Search by category as well as its importance. Now let’s get started to search by category feature to your store and serve your customers in the best way.

General configuration

At the admin backend, login to your admin account, and then follow these steps: Store > Settings > Configuration > Mageplaza extensions > Search.

General configuration

In the general configuration, complete all required fields with proper content.

Search by category configuration

First of all, choose Yes to activate the Mageplaza’s Search extension. Then, at the Maximum number of search results field, enter a number that presents the limitation of the search results, you want to appear after each search action. The default is 10.

Next, you can limit the length of a product’s description displaying along with it on the search result pages. To make the product’s search result more informative, choose the additional elements to show such as price and image. You can choose these elements individually or all at once.

In the Reindex Search database field, there are three options for you. The first one is the Cron job, which is suggested to use when your store owns over 3000 products. The second one is After Product Save, which is suitable for online stores with less than 3000 products. The last one is Manually that requires more work efforts because you have to click on the reindex button whenever there are changes in the products’ information.

Search by category configuration

To configure search by category in Magento 2, in the Magento admin panel, please go to the Search by category configuration section.

Search by category configuration

Open the search by category section, then choose Yes to enable the feature. By this search functionality available in Mageplaza Ajax Search, customers can use product categories to search for their wanted items quickly.

In the Maximal Depth field, enter a number that is the total level of categories displayed in the search bar. The first level is usually “All categories.” The second level is the dropdown of individual product categories, which shows more detail.

Search by Category on the frontend

frontend display of saerch by category

The dropdown of categories in the search box makes it easier that customers can select a specific category and quickly find their items.

Final words

To configure search by category in Magento 2 is undoubtedly a great way to make products on an online website more accessible to customers. If you already find it essential to apply this function to your store, Mageplaza Ajax Search is the right choice. Our extension supports the search by category feature that will improve your store’s product search functionality. If there is something unclear you need to clarify or any recommendations for us, feel free to leave your comments under this article.


Hello, I'm the Chief Technology Officer of Mageplaza, and I am thrilled to share my story with you. My deep love and passion for technology have fueled my journey as a professional coder and an ultra-marathon runner. Over the past decade, I have accumulated extensive experience and honed my expertise in PHP development.

Related Post

Website Support & Maintenance Services

mageplaza services

Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.