Tagged: enfold, related products
Were I can specify the number of products displayed in the “Related products” in the individual product page.
At this timeI have 4 products displayed but I would like to have 5 or 6 items. Is there a place where I can adjust
it or can I add something in the Quick CSS?
Thanks,
Hey AlainTernet,
Can you try this code in functions.php (just adjust the values):
function woo_related_products_limit() {
global $product;
$args['posts_per_page'] = 6;
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
function jk_related_products_args( $args ) {
$args['posts_per_page'] = 6; // 6 related products
$args['columns'] = 2; // arranged in 2 columns
return $args;
}
Hope it helps.
Best regards,
Nikko
Thanks for your reply, i will try this.
On the other hand, if I write code in the functions.php file, I risk losing them during a next update? (I just all updated my site which was 5-6 years old and lost a lot of content and a lot of my customization). What is the way to avoid this?
Hi AlainTernet,
We’re sorry to hear that.
The best way you can do when tweaking is to use a child theme.
You can download it here and follow the instructions on how to use it: https://kriesi.at/documentation/enfold/child-theme/
Best regards,
Nikko