Replace WP search by Woocommerce search in nav

Hi! Is there a way to replace the search field in nav/header of the site (betheme) by the search field of woocommerce.

Because actually when i make a request on the search field it's just show me blog/page/articles and no picture.

I've tryied this :

add_filter( 'pre_get_posts', 'custom_pre_get_posts' );
function custom_pre_get_posts( $query ) {
    if ( is_search() ) {
        $query->set('post_type', 'product');
    }

    return $query;
}

Now its show me product but no picture, products are shows like simple pages/paragraphs, not very esthetic...

Thanks

Comments

Sign In or Register to comment.