woocommerce_redirect_single_search_result

woocommerce_redirect_single_search_result

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_redirect_single_search_result') is found 1 times:

  • /includes/wc-template-functions.php line 58
    		exit;
    	}
    
    	// Redirect to the product page if we have a single product.
    	if ( is_search() && is_post_type_archive( 'product' ) && apply_filters( 'woocommerce_redirect_single_search_result', true ) && 1 === absint( $wp_query->found_posts ) ) {
    		$product = wc_get_product( $wp_query->post );
    
    		if ( $product && $product->is_visible() ) {
    			wp_safe_redirect( get_permalink( $product->get_id() ), 302 );
    			exit;
    		}