GET FREE VERSION GET THE PRO VERSION

Fix search page redirect for single result

Learn how to disable redirects for search results pages when there is only one item in the search results.

In this article

Overview

By default WooCommerce has one specific behaviour for its products search results page - it automatically redirects users to the product page if there is only one product in the search results.

In most cases this sounds logical and for most users this behavior is fine.

But it is possible that for your particular case you still need to show a search results page even if it has only one product search result. Good news is that it is possible. Just need to use some small custom code snippets.

How to fix

All you need is to use the following code snippet:

add_filter( 'woocommerce_redirect_single_search_result', '__return_false' );

Place it inside your child theme functions.php file or use any of the custom code snippets plugins for this.

That's all! Now you will see the search results page even if there is only one product in the search results list.

Single result inside live search box

Single result inside live search box

Single result inside search results page

Single result inside search results page