I woulkd like to linit the amount of related products listed on the products pages, Currentlt it is showing 50 related products! This is causing y product pages to load exceptionally slowly. Could you advise.
I have seen on the woocommerce support site that this should chnage the amount of products lited but it is not working, i wonder if your theme overides this:
/**
* WooCommerce Extra Feature
* ————————–
*
* Change number of related products on product page
* Set your own value for ‘posts_per_page’
*
*/
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’] = 4; // 4 related products
$args[‘columns’] = 2; // arranged in 2 columns
return $args;
}