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.
This topic has 8 replies, 2 voices, and was last updated 1 months ago ago by Luca Rossi
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.
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!
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.
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!
Hi Luca,
Credentials shared as requested. Thank You
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
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.
If you require any further assistance, please do not hesitate to contact us.
Best regards,
The 8Theme Team
You must be logged in to reply to this topic.Log in/Sign up