How to Add Customize WooCommerce Product Search to Stores

by Owais Alam  June 28, 2017

WooCommerce has a very basic product search form that often don’t provide enough information. Many store owners often try to replace this with a custom form.

Customize WooCommerce Product Search

In this tutorial, I will discuss a quick method of overriding the default product search form. I will use the the get_product_search_form filter for this. You could use a custom template with the name product_search_form.php.

I will add a custom code snippet to the functions.php (located in the themes folder). This code snippet will replace the default product search from in the search widget.

At this point, you could create your own custom search form, use a placeholder or add CSS classes. For this, go to the theme folder and create a new file with the name product_search_form.php. Open this file and add the following code to it:

Note that the template file will take priority over any filter based method(s). thus, even if you use a filter, the presence of the template file will ensure that the search form would come from the file rather than the template.

In order to implement AJAX based search, you could use another custom code snippet. This snippet allows you to modify the search parameters. In addition, you could also deactivate AJAX based search by setting ajax_disable to TRUE.

Conclusion

In this tutorial, I discussed how to add a customized In this tutorial WooCommerce product search through a custom template file. If you need any help with the code, do leave a comment below.

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Owais Alam

is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at owais.alam@cloudways.com

Stay Connected:

You Might Also Like...