How can i get advance search block on home page magento 2. i want to show specific attributes in drop-down on home page.

2 Answers 2


Magento’s default catalog search can be a powerful tool. It’s versatility is something every customer can appreciate.

One of the coolest features of the built-in advanced search is the ability to search by attributes assigned to a product. But what if your client’s plans for search are a bit different, and advanced search is too cluttered for his or her needs?

Let’s say your client wants his customers to be able to search by brand or SKU, with all other fields removed from the search, and wishes for custom URL for each one of those search types.

The solution

Attached in this article is a little “module” that enables you to use your custom URL for advanced search.

Not only that, but you can specify a single attribute you want to search by!

You could even use this to implement search by brand or SKU.

Keep in mind, though, that this is a custom developed module, without admin options, so everything you want to do with this search module has to be done by code.


it can be done easily in your child theme, you have to do the following steps:

1- Make your attributes searchable from admin that you want to show in the form. 2- Create a new template if you want to change the layout or customize the default behavior app/design/frontend/Vendor/Theme/templates/your-file.phtml 3- Now customize you theme layout file and embed the template at any location for example i have done in header like this. Move you parent theme default.xmllayout file in app/design/frontend/Vendor/Theme/layout/default.xml

Add the following code where you want the search:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <referenceContainer name="page.wrapper">
      <block class="Magento\CatalogSearch\Block\Advanced\Form" name="catalogsearch_advanced_form"

bin/magento c:f

bin/magento c:c

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.