This topic has 10 replies, 3 voices, and was last updated 8 years, 9 months ago ago by Eva Kemp
Hello,
How can I limit the number of products displayed in the related products tab (on a product page).
Thanks.
Hello,
Please refer to Woocommerce article:
https://docs.woothemes.com/document/change-number-of-related-products-output/
Regards,
Eva Kemp.
Ok thank you, what does the second part of the function means?
add_filter( ‘woocommerce_output_related_products_args’, ‘jk_related_products_args’ );
function jk_related_products_args( $args ) {
$args[‘posts_per_page’] = 4; // 4 related products
$args[‘columns’] = 2; // arranged in 2 columns
return $args;
}
Thank you.
Hello,
It means you’ll have 4 products in 2 columns.
What exactly is unclear for you?
Regards,
Eva Kemp.
Hello,
Ok thank you, I put the value “4” in “post per page” but I still have 5 related products displayed…
Hello,
Please provide us with FTP and wp-admin panel credentials in Private Content.
Regards,
Eva Kemp.
Hello,
Hello,
I’ve edited the file wp-content/themes/royal/woocommerce/single-product/related.php in line 13 and set number “4” in the code $posts_per_page = 4;
.
Please check related products now.
Best regards,
Jack Richardson.
Everything’s ok, thanks a lot.
Hello,
You’re welcome.
Regards,
Eva Kemp.
The issue related to '‘Limit related products’' has been successfully resolved, and the topic is now closed for further responses