How to Disable the WooCommerce Single Search Result Redirect

WooCommerce comes out of the box with plenty of little “quality of life” interface improvements and adjustments for your visitors. These tweaks are meant to give customers the quickest route from browsing products, to adding them to their cart and checking out.

One of these improvements is how WooCommerce handles searches that return only one result. When there is only one product that matches a search query the user is not presented the search results screen at all. Instead, they are taken directly to the only product that matches what they were looking for.

For example, let’s say you only have one pair of sunglasses for sale on your store. If a user searches for “sunglasses” in your site’s search box they will be redirected straight to the Sunglasses product page.

The intention is to make your potential buyer have to take one less click than necessary to get to the product they want. But what if you don’t want that redirect to take place?

Maybe your search results page has shown, through your analytics, that people who visit tend to buy more than one product. In that case, you would want the people doing searches to see the results screen no matter what.

You can disable the WooCommerce single search result redirect with some code or using our plugin. We’ll walk you through the process with code first.

How to Remove the WooCommerce Single Search Result Redirect with Code

You can disable the WooCommerce single search result redirect from your site with just a few lines of code. Please make sure you follow these steps closely though. Doing something wrong can result in errors on your site and potential downtime.

Warning! Before you get started please make a full backup of your WordPress site. This will be important in case you make a mistake and need to go back to how your site was before you got involved. It’s also recommended you work on your local computer and never adjust files on a. live site.

Create a Child Theme

The WordPress theme system is very robust. One of the upsides is that you can download theme updates right inside of the admin. The downside of this is that any changes you make to your theme will be lost after each update. To work around this you have to make a child theme.

Child themes use a parent theme’s files as a base and then load its files on top of that. We can use this system to create changes to the parent theme and know that those changes will stay throughout any future updates. Follow this tutorial at WPBeginner to make your own child theme and then we can move on to dealing with actual code.

Add Code to a Child Theme

Your child theme needs a file called functions.php. This is where most common code changes and additions are placed in WordPress themes. If that file doesn’t exist you need to create it. Then open it up in a text editor and add the following lines of code to it:

add_filter( 'woocommerce_redirect_single_search_result', 'my_remove_search_redirect', 10 );
function my_remove_search_redirect() {
    return false;	 	 

When you have the above code snippet in place you can save the functions.php file. We’re done dealing with code. Now it’s time to get this child theme on your live site.

Upload Your Child Theme

You can get your new child theme on your WooCommerce store in one of two ways. The most common is to compress all of the child theme files and upload that through the WordPress admin. This can all be handled under the Appearance menu.

Another option is to use an FTP program and upload the files directly to the server. If you are unfamiliar with how FTP works your web hosting provider most likely has documentation to help you. It’s also possible you can find a freelancer to help you out with this as well.

Has this gotten a bit too technical for you? There is another way to deal with disabling the WooCommerce single search result redirect. It doesn’t involve creating themes, editing code, or upload files. Jump ahead and learn how our Remove WooCommerce Features plugin can help.

Active the Child Theme

Once the child theme has been successfully uploaded you need to turn it on. Head on over to the Appearance section of the WordPress admin to find your child theme. If it doesn’t show up anywhere you made a mistake during the upload process.

Activating the theme should have an immediate impact on your site. The WooCommerce single search result direct should be disabled. If the search result redirect still happens or your site is throwing errors there is a problem with the code in your child theme. Check out the code you added to the functions.php file and see if you made a typo or a mistake. When you’re sure it’s right upload and try again.

That was a lot of steps but you did it. You are now kind of a WordPress theme developer. If you’ve gotten this far but it still seems like a lot of work there is another choice. You can check out our Remove WooCommerce Features plugin and have it do all of the work automatically.

How to Stop the Single Product Search Result Redirect the Easy Way

Remove WooCommerce Features offers a way to disable this search redirect function. There’s no need to edit files, insert code, or pay a developer to do the work for you.

After you’ve purchased and installed the plugin you can turn redirects off in a moment by following these steps.

Step #1

Go to the WooCommerce section of your WordPress installation’s admin menu and click the link that says Remove Features.

WooCommerce Admin Menu

Step #2

Find the setting for Product Search Redirect on Single Result and click the checkbox so that it’s marked like so:

Remove WooCommerce Features - Product Search Redirect on Single Result

Step #3

Press the button.

As soon as you press Save Settings the change will go into effect.

The beauty of using Remove WooCommerce Features to handle this, as opposed to making changes to your theme’s code, is that the change will last regardless of any theme updates or changes you make to your site going forward. The plugin remembers your setting and applies it as long as you have Remove WooCommerce Features installed and activated on your site.

Our plugin does a whole lot more than just turn off this default search redirect. You can use it to remove or disable dozens of WooCommerce features without having to write or manage any code yourself.

Remove WooCommerce Features Logo