Woocommerce search not working. How to fix ?

WooCommerce search not working- How to fix?

Rate this article

Share this article

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.

Woocommerce search not working. How to fix ?

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.

JetBackup – WP Backup, Migrate & Restore

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: Conflicts with other plugins can often cause issues with WooCommerce search. To identify if a plugin is causing the problem, deactivate all non-essential plugins and test the search functionality. If the search starts working again, reactivate the plugins one by one until you find the culprit. Make sure all plugins are updated to their latest versions to minimize compatibility issues.
  8.  Update the WooCommerce Database: Outdated or corrupted database tables can also lead to search problems in WooCommerce. To update the WooCommerce database, navigate to WooCommerce > Status > Tools. Here, you’ll find an option to “Update WooCommerce Database.” Click on it to run the update process. This will ensure that your database is optimized and compatible with the latest WooCommerce version.
  9. Check With Your Hosting Provider: The first step in troubleshooting any issue with your WooCommerce store is to contact your hosting provider. Sometimes, server issues or configuration settings can affect the search functionality. Ask them if there are any server-side issues or if any recent changes have been made that could impact the search feature.
  10. Check Catalog Visibility Settings: WooCommerce offers catalog visibility settings for products, which determine how they appear in search results. Ensure that the visibility settings for your products are configured correctly. Go to the product edit screen, and under the “Publish” meta box, check the visibility settings. Products should be set to “Catalog” or “Search & Catalog” to appear in search results.

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. Login to your wordpress admin panel and in the left panel click on plugins->add new plugin . Now search by name wp fastest site search and install the plugin. After installing and activation you willbe navigated to the signup page . Create an account. That’s it .  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" name="s" id="s" placeholder="Search Something" />
    <input type="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 –

HUSKY – Products Filter for WooCommerce Professional

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

FAQ:

Why aren’t my new products showing up in WooCommerce search results?

New products may not immediately appear in search results due to various reasons such as indexing delays or incorrect visibility settings. To ensure new products show up in search, verify that they are published with the appropriate catalog visibility settings (Catalog or Search & Catalog). Additionally, consider reindexing your products or clearing any cache that may be affecting search results.

Why are new products in WooCommerce not showing?

New products may not be showing in search results due to caching issues, incorrect visibility settings, or search index delays. Double-check that your products are published with the correct visibility settings and consider clearing any cache plugins or server-side caching that might be affecting search results. Reindexing your products can also help refresh the search index and display new additions promptly.

Why is the WooCommerce search not working within specific product categories?

If the WooCommerce search isn’t functioning within specific categories, it could be due to conflicting plugins, incorrect settings, or issues with the search index. Troubleshoot by deactivating non-essential plugins, verifying category visibility settings, and reindexing products. Ensure that products within the category are published and have appropriate visibility settings to appear in search results.

I’m getting no results when searching for products in WooCommerce. What should I do?

If you’re experiencing no results in WooCommerce product search, start by checking if products are published and have correct visibility settings. Ensure that your search index is up to date by reindexing products. If the issue persists, consider deactivating plugins that may be conflicting with the search functionality or reaching out to your hosting provider for assistance with server-related issues.

I’m unable to find a product in WooCommerce by searching for its SKU or product number. How can I resolve this?

If you can’t find a product by searching for its SKU or product number, ensure that WooCommerce is configured to include SKU in search results. Check the search settings in WooCommerce and verify that SKU is enabled for search. If the problem persists, consider reindexing products or using a dedicated search plugin that offers more robust search functionality, including SKU-based searches.

My WooCommerce search stopped working after a recent update. How can I fix this issue?

A WooCommerce update may have caused conflicts with other plugins or affected the search index. Troubleshoot by deactivating recently updated plugins, ensuring compatibility with the latest WooCommerce version, and reindexing products. If the problem persists, consider rolling back the WooCommerce update temporarily while you investigate and resolve the issue.

I’ve installed WooCommerce, but the search functionality is not working. What could be causing this?

If search is not working after installing WooCommerce, check for conflicts with other plugins, ensure that products are published with correct visibility settings, and reindex products to refresh the search index. Additionally, verify that your theme is compatible with WooCommerce and doesn’t override default search functionality. If the problem persists, consider reaching out to WooCommerce support or forums for further assistance.

My WooCommerce search results are not displaying relevant products. What could be the issue?

If search results are not showing relevant WooCommerce products, ensure that products are properly categorized, tagged, and have descriptive titles and descriptions. Check for any conflicts with plugins that may be affecting search functionality and consider reindexing products to update the search index. You can also explore using advanced search plugins or customizing search settings within WooCommerce to improve result relevance.

Fix your WooCommerce search

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like