Here are a few fixes to solve the “WooCommerce search not working issue” without getting into code. Search is a key feature in any WooCommerce store, and failing to return the correct results can lead to losing out on valuable sales due to lost product discovery.

How to fix WooCommerce search not working

How to fix WooCommerce search not working

 

Fix your WooCommerce search

Common issues with WooCommerce search

  • WooCommerce search function not working.
  • WooCommerce search results don’t show products.
  • WooCommerce product search in admin is not working.
  • WooCommerce search products by title, category, tag, or brand are not working.
  • WooComerce admin product search not working.
woocommerce search not working

Take a Backup!

It is an excellent practice to take a backup with any good backup plugin of your choice before making the below changes. Then, if something goes wrong, you can also revert to the old setting using this backup.

We recommend a backup guard for this. We can personally vouch for this since we use a backup guard for our everyday backups. You can also use another plugin, “Updraft plus,” for taking these backups.

WordPress Backup and Migrate Plugin – Backup Guard

Some simple fixes for WooCommerce search issues

  1. Clean your WooCommerce database using the WP optimize plugin.
  2. Upgrade to the latest version of WordPress from your WordPress admin panel.
  3. Upgrade WooCommerce database.
  4. Upgrade your WooComerce plugin to the latest version.
  5. If you have any caching plugins, delete the cache and try searching again.
  6. Usually, themes such as the Sydney, Revo themes could conflict with WooCommerce. Change your theme to a default WordPress theme like Twenty nineteen, Astra, or Generatepress.
  7. Deactivate plugins and check compatibility with your WooCommerce search by enabling one plugin at a time.
  8. Reindex and upgrade your WooCommerce database.
  9. If you have enabled some security plugin like Wordfence, try disabling it and retest your search bar.
  10. Try adding an external search plugin like Expertrec.

If all the above methods didn’t work, you could try out the methods below or contact our support team.

Check catalog search visibility

If some of your products are not getting displayed in the catalog search, you can check the product’s visibility by clicking on the edit product link. You can choose from the options below depending on your need.

  1. Shop and search results.
  2. Shop only.
  3. Search results only.
  4. Hidden.
woocommerce search not working

Fix “WooCommerce search not working” with WP Fastest Site search

If your problem is related to one of the following problems, you are one the right place.

  1. There is a huge delay in showing the search result.
  2. The search result page takes more time to display the search result.
  3. There are more than 1000 products in your WooCommerce store and because of that, the search is very slow.
  4. Your products have many attributes that are ignored when searching!

 

     You should Try WP Fastest Site Search by ExpertRec

    WP Fastest Site Search

    Fixing your WooCommerce search not working issue with the WP Fastest site search is one of the quickest and reliable ways. Just install the extension from the above link and once you create your search index from their control panel, add your default WooCommerce search will be replaced with a beautiful new search engine similar to the image below. This plugin costs $9 per month.woocommerce search not working

     

    Fix for Woocommerce search results don’t show products.

    By default WordPress searches only blogs and pages without searching your WooCommerce products. To do this, replace your search form.

    <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
        <label for="s">Search</label>
        <input type="text" class="field" name="s" id="s" placeholder="Search Something" />
        <input type="submit" class="submit" name="submit" id="searchsubmit" value="Search" />
        <input type="hidden" name="post_type" id="post_type" value="product"  />
    </form>

    Woocommerce product search in admin is not workingWoocommerce product search in admin is not working. To fix this issue, disable the Yoast SEO plugin and add the following code to the functions.php file.

    add_action( 'pre_get_posts', 'products_pre_get_posts' );
    function products_pre_get_posts( $query ) {
    
      if(is_admin()){
         $query->set( 'tax_query', array(
            array(
                'taxonomy'  => 'product_cat',
                'field'     => 'term_id',
                'terms'     => get_terms( array( 'taxonomy' => 'product_cat', 'fields' => 'ids' ) )
            )
        ));
      }
    }

    If it is still not working, add the following code to your functions.php file.

    function m_request_query( $query_vars ) {
        global $typenow;
        global $wpdb;
        global $pagenow;
    
        if ( 'product' === $typenow && isset( $_GET['s'] ) && 'edit.php' === $pagenow ) {
            $search_term  = esc_sql( sanitize_text_field( $_GET['s'] ) );
        // Split the search term by comma.
            $search_terms = explode( ',', $search_term );
        // If there are more terms make sure we also search for the whole thing, maybe it's not a list of terms.
            if ( count( $search_terms ) > 1 ) {
                $search_terms[] = $search_term;
            }
        // Cleanup the array manually to avoid issues with quote escaping.
            array_walk( $search_terms, 'trim' );
            array_walk( $search_terms, 'esc_sql' );
            $meta_key               = '_sku';
            $post_types             = array( 'product', 'product_variation' );
            $query                  = "SELECT DISTINCT posts.ID as product_id, posts.post_parent as parent_id FROM {$wpdb->posts} posts LEFT JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id WHERE postmeta.meta_key = '{$meta_key}' AND postmeta.meta_value IN  ('" . implode( "','", $search_terms ) . "') AND posts.post_type IN ('" . implode( "','", $post_types ) . "') ORDER BY posts.post_parent ASC, posts.post_title ASC";
            $search_results         = $wpdb->get_results( $query );
            $product_ids            = wp_parse_id_list( array_merge( wp_list_pluck( $search_results, 'product_id' ), wp_list_pluck( $search_results, 'parent_id' ) ) );
            $query_vars['post__in'] = array_merge( $product_ids, $query_vars['post__in'] );
        }
    
        return $query_vars;
    }
    add_filter( 'request', 'm_request_query', 20 );

    WooCommerce search not working – products by title, category, tag, or brand are not working

    To fix this issue, apart from the WooCommerce search not working, install the free products filter for the WooCommerce plugin. https://wordpress.org/plugins/woocommerce-products-filter/. It enables product filtering by –

      • products categories,
      • products attributes,
      • products tags,
      • products custom taxonomies
      • products price.

    WOOF – Products Filter for WooCommerce

    Create your own WooCommerce custom search engine 

    This method is suitable if you don’t want to rely on external plugins and want to build your own search engine where you have good control over every aspect of your search engine.

    1. Sign up at WooCommerce search engine.
    2. Choose your nearest data center.
    3. Enter your product sitemap URL.
    4. Now the search engine crawler will begin crawling your website.
    5. Go to Crawl-> what to crawl-> SitemapCrawl-> what to crawl-> Sitemap and remove unnecessary sitemap URLs. Also, enable crawl-only sitemap.
    6. Go to Install-> code and copy-paste the code to the head section of your WooCommerce website.
    7. You can now replace your existing WooCommerce search form with this.woocommerce search not working

    Fix your WooCommerce search

    Muthali loves writing about emerging technologies and easy solutions for complex tech issues. You can reach out to him through chat or by raising a support ticket on the left hand side of the page.

    You may also like

    Black Friday Deal          50% off on all plans with this code BLACK50
    Black Friday Deal         Upgrade your search bar today and enjoy flat 50% off with this code BLACK50
    Black Friday Deal
            50% off with this code BLACK50
    Days
    Hrs
    Mins
    Sec