This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

This holiday season, maximize your sales through enhanced website performance and 24/7 caring support. SAVE 30% NOW

How to Add Customize WooCommerce Product Search to Stores

Updated on  28th June

3 Min Read
Reading Time: 3 minutes

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.

Share your opinion in the comment section. COMMENT NOW

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

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

Get Our Newsletter
Be the first to get the latest updates and tutorials.

THERE’S MORE TO READ.