How to change Avada header search bar into Woocommerce search bar

The Avada WordPress theme integrates with Woocommerce very neatly. but there are small things like the Search Bar in the header that uses the old WordPress search page rather than the Woocommerce search page. The difference between the search pages is that the WordPress search page finds all matching results from not just Woocommerce products but also blog posts etc. The customer may only want to search for what is inside of Woocommerce.

Preparing the work area

We highly advise you to create a child theme before making any modifications if you haven’t done so already. This is common practice as your customizations will not be lost or affected whenever the themes and plugins are updated.

Overwriting searchform.php

In the base of your child theme directory, create a file with this exact filename: “searchform.php” (without the quotations). Then paste the following code inside of that file and save:

What is happening here is that WordPress will run this version of the searchform.php instead of the original theme’s searchform.php . We have only tweaked the code slightly to change the form action on line 15 to point to the Woocommerce store instead.

That’s it for this simple tutorial! Don’t forget to leave any questions or comments below.

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *