Search Results Page Showing Only 10 Products With Pagination

7 replies2 participantsUpdated by Luca Rossi

  • Avatar: CreamOne
    Yasar
    Participant

    We have search results page built using Elementor, but I see its showing only 10 products on search results page with pagination, instead I want to list all the products with relevant terms on the page without pagination.

    Please, contact administrator
    for this information.

    7 Answers

    Avatar: Justin
    Luca Rossi
    Support staff

    Dear @Yasar,

    Please try adding this custom code under functions.php file locates in your child theme:

    
    // Show all WooCommerce product search results
    add_action( 'pre_get_posts', 'show_all_wc_search_results' );
    function show_all_wc_search_results( $query ) {
        
        if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
    
            // Ensure only modify WooCommerce product search query
            if ( isset( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] === 'product' ) {
                $query->set( 'posts_per_page', -1 ); // Show all results
            }
        }
    }
    

    Hope it helps!

    Avatar: CreamOne
    Yasar
    Participant

    Dear Team,

    Thanks for the reply, I tried the code, but still it’s same and it’s showing only 10 products with Pagination. The search results page was developed with Elementor and its product archives What I am using.

    But, with this element, there is no any settings to show all products in search results. Advise.

    Avatar: Justin
    Luca Rossi
    Support staff

    Dear @Yasar,

    Could you please provide temporary wp-admin access? We need to check your settings.

    To grant WP-Admin access, please proceed to create a new user account with an administrator role through your WordPress Dashboard. Once the account is established, you may securely transmit the username and password to us via the Private Content section designated for this purpose.

    Thank you!

    Avatar: CreamOne
    Yasar
    Participant

    Hi Luca,

    Credentials shared as requested. Thank You

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff

    Hello @Yasar,

    Could you please review it once more?

    https://creamone.com/?product_cat=0&s=cake

    You are welcome to adjust the style of the search results as you see fit.

    Best regards,
    The 8Theme Team

    Avatar: CreamOne
    Yasar
    Participant

    Luca Rossi,

    Thank You, the results are showing fine now as expected and I have made some style changes as you said, Thanks Much for the support.

    Avatar: Justin
    Luca Rossi
    Support staff

    If you require any further assistance, please do not hesitate to contact us.
    Best regards,
    The 8Theme Team

Want to reply? Log in, or register with your ThemeForest purchase code, to reply to this topic.

Login / Register