How to Disable WooCommerce’s Product Redirect after a Single Search Result
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 this single search result redirect with some code that you will need to add to your WooCommerce theme by yourself or by having a paid developer do it for you.
Or you can check out our Remove WooCommerce Features plugin and have it do all of the work automatically.
How to Disable the Single Product Search Result Redirect with Our Plugin
Remove WooCommerce Features has support for disabling this search redirect function built-in. 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 this off in a moments by following these steps.
Go to the WooCommerce section of your WordPress installation’s admin menu and click the link that says Remove Features.
Find the setting for “Redirect to Product on Single Search Result” and click the checkbox so that it’s marked like so:
Press the button.
As soon as you press Save 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. You can use the plugin to:
- Remove the Sorting Dropdown from Categories
- Disable In Stock and Out of Stock Messages on Products
- Remove the Coupon Code Fields from Your Store
- … and a lot more.
There is a comprehensive list of all the features the plugin works with here on our site if you’d like to see everything Remove WooCommerce Features can do for you.