Forums Forums Search & Filter Pro replace standard native search header WooCommerce

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #269667

    Hi, I installed the plugin and it seems it’s working fine used in a widget. I have also to replace the standard search bar in the header that comes with the theme, how can I achieve this? I have WooCommerce installed and need to search only products. Thank you!

    Trevor
    #269697

    The easiest thing to to is to use a WordPress re-write. Assuming that you have our search form on the shop page, named ‘shop’, something like this in the child theme functions.php file:

    function sandf_change_search_url_rewrite() {
    	if ( is_search() && ! empty( $_GET['s'] ) ) {
    		wp_redirect( home_url( "shop/?_sf_s=" ) . urlencode( get_query_var( 's' ) ) );
    		exit();
    	}	
    }
    add_action( 'template_redirect', 'sandf_change_search_url_rewrite' );

    You would need to change the word shop if needed, and there might need to be other changes needed, depending on how your header search works. Note, the Search & Filter form on the results page must have a Text search field to receive the search string. You would not need/want to have the post type in the parameters, as this is specified in our form settings instead, so you should remove that from the theme code/template you already use.

    Anonymous
    #269819

    Hi Trevor,

    Thank you. Can you maybe implement it for me, for an additional cost?

    That would be great. Thanks.

    Tara

    Trevor
    #269821

    I am sorry, we do not provide additional services like that.

Viewing 4 posts - 1 through 4 (of 4 total)