Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1341396
    Edgar
    Guest

    Hello, my site is datempl.com. I have theme enfold and I want to customize my search result page. I want to search the result page exactly like the product page and I don’t want it to show the posts, only woocommerce products.
    like this https://i.ibb.co/nnLs469/Screenshot-2022-02-19-164354.png

    #1341578

    Hey Edgar,

    Thank you for the inquiry.

    The search results can be limited to products only but the layout that you are after will require modifications that are beyond the scope of support. You may need to hire a freelance developer to help you with the modification.

    To limit the search results to products, just add this code in the functions.php file.

    // show products in the search results
    function avf_search_filter_pages($query) {
        if ($query->is_search) {
            $query->set('post_type', 'product');
            $query->set( 'wc_query', 'product_query' );
        }
        return $query;
    }
    
    add_filter('pre_get_posts','avf_search_filter_pages');

    Please register an account to the forum using your purchase code.

    // https://kriesi.at/support/register/

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.