Limit related priducts - by fourth-element

This topic has 4 replies, 2 voices, and was last updated 6 years, 11 months ago ago by Rose Tyler

  • Avatar: fourth-element
    fourth-element
    Participant
    December 4, 2017 at 18:00

    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;
    }

    3 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    December 5, 2017 at 09:26

    Hello,

    Please read this topic https://www.8theme.com/topic/limit-related-products/

    Regards

    Avatar: fourth-element
    fourth-element
    Participant
    December 5, 2017 at 10:15

    Many thanks

    I have now updated the related products.php file in my child theme. The code i Supplied from Woocommerce doesn’t work with your theme. Would it be possible on your next update to add this option in the CMS to change the number of related products, I have seen you have done this in another theme. Loading 50 related product images is going to slow any website down and this is the number set in the related.php file.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    December 5, 2017 at 10:20

    Hello,

    I’ve passed this topic to our developers, hope this will be added in next theme update.

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.