How to disable redirect to product page instead of search page in woocommerce

If there is only one result while searching then woo-commerce redirects a user directly to the product page. It’s woo-commerce’s default feature. We can disable it by using the following code :


add_filter( 'woocommerce_redirect_single_search_result', '__return_false' );