Customize WooCommerce Products Search Form

Remi | December 12, 2013 | in WooCommerce

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.

The author

About the author Remi: Hey! My name is Rémi Corson, i'm a WordPress Expert Developer, i create high level themes and plugins, and i provide free stuff every week on this website!


  1. Pingback: Blogging for Benjamin Update | Daniel Espinoza

  2. Philipp_Schubert

    Hi Remi,

    i have the Problem that the woocommerce search only searches for the title field of a woocommerce product.
    I have severeal custom fields added, as you described in another post (here), which i need to be searched too.
    Ideas or solutions in mind?



  3. vinayshah5

    Can we search product through their attribute.
    For example i have clothes ecommerce site,
    Where i have text box for size, bust, color.
    According to the matched value it should show particular product

  4. alexcappello

    I would like add suffix on product search page url. For example:
    normal url:
    my custom url:

    So my suffix is: &product_view=list
    Can you help me? Thanks.

    1. alexcappello

      I resolved. I add a form for woocommerce product search in header.php

      <form role="search" method="get" id="headersearchform" action="” >


Leave a reply