Customize WooCommerce Products Search Form
Here is a quick method that will allow you to override the WooCommerce default products search form. Basically, to do this, you have two options. You can use the get_product_search_form filter. That’s the easiest solution, but you can also use a custom template that you have to name product-searchform.php. Please note that usually, when you work with WooCommerce custom templates you need to place them in a folder called “woocommerce” within your theme folder. Well, that’s not the case with template.
Using a Snippet
To override the default WooCommerce products search form (that is use in search widget), you can decide to simply add this snippet to the functions.php file within your theme folder:
You can then create your own custom search form, use any value for the placeholder, add CSS classes, or whatever.
Using a Custom Template File
The second method is to use a custom template file. As stated above, you don’t have to place the file in a woocommerce folder in your theme folder. So, create a new file in your theme folder, and name it product-searchform.php. And within that file, place the following code:
And boom, the magic appears! You can then customize your custom template as you wish.
Please note that the template file method will have the priority over the filter method. In other words, if you use use a filter and if a file called product-searchform.php exists, then the filter will not be taken into account, and the search form will be populated from the template file. Finally, i’d like to mention that this method is pretty unique in WooCommerce, and all other custom templates must be placed within a woocommerce folder in your theme folder.