SearchWP

WooCommerce Legacy Instructions

These instructions are considered deprecated. Please use the official WooCommerce extension instead

WooCommerce uses what can be considered it’s own internal search mechanism that kind of hijacks post type archives. You’ll notice that after searching, the URL has &post_type=product appended to the end.

This is why your search results have not changed; SearchWP is not in use when you visit CPT archive pages.

In order to resolve this issue, you need to remove a hidden input that WooCommerce injects into your search forms. To do so, you need to create a new file in your theme directory named product-searchform.php with the following:

<form role="search" method="get" id="searchform" action="<?php echo esc_url( home_url( '/'  ) ); ?>">
    <div>
        <label class="screen-reader-text" for="s"><?php _e( 'Search for:', 'woocommerce' ); ?></label>
        <input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="<?php _e( 'Search for products', 'woocommerce' ); ?>" />
        <input type="submit" id="searchsubmit" value="<?php echo esc_attr__( 'Search' ); ?>" />
    </div>
</form>

See their documentation for additional information.

Once you have that file in place and you submit a search you will see that your search results have improved, but the results template doesn’t look like it did. That again is due to WooCommerce using a CPT archive template for search results. To get the WooCommerce product-focused search results back in place, copy

~/wp-content/plugins/woocommerce/templates/archive-product.php

to your theme folder and rename it as search.php. This is now your search results template, you can customize it in any way that you’d like.

Want to make your search awesome right now?

More than 30,000 sites have chosen SearchWP!

You can utilize all of the content that’s gone unrecognized by native WordPress keyword search instantly with SearchWP.

Get SearchWP for just $99

  • Committed Support
    If you need help, support is fast, friendly, and here for you
  • Streamlined Setup
    Installation and setup that’s optimized for speed
  • Great Documentation
    Helpful, clear, and usable documentation is a priority

See what SearchWP customers have to say

  • “I had some difficulties to get different results if users are logged in or not. Support was more than code snippets. Complete functions were sent to add in the function.php of my child theme. Very competent and very friendly support! -Henner”

  • “My website contains an archive of digitised historic journals – hundreds of PDFs. Using Search WP allowed me to build an advanced search, index all PDF content, and returning matching results in a highly customisable format. Top notch support too!”

  • “The plugin works exactly as promised. Any questions or issues I had were quickly responded to and had a fairly complex site up and running in hours.”

[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]