Limit related products - by jeremy - on WordPress WooCommerce support

This topic has 10 replies, 3 voices, and was last updated 8 years, 9 months ago ago by Eva Kemp

  • Avatar: tlgv
    jeremy
    Participant
    January 23, 2016 at 18:00

    Hello,

    How can I limit the number of products displayed in the related products tab (on a product page).

    Thanks.

    9 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    January 24, 2016 at 09:26

    Hello,

    Please refer to Woocommerce article:
    https://docs.woothemes.com/document/change-number-of-related-products-output/

    Regards,
    Eva Kemp.

    Avatar: tlgv
    jeremy
    Participant
    January 24, 2016 at 13:28

    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.

    Avatar: Eva
    Eva Kemp
    Support staff
    January 25, 2016 at 14:16

    Hello,

    It means you’ll have 4 products in 2 columns.
    What exactly is unclear for you?

    Regards,
    Eva Kemp.

    Avatar: tlgv
    jeremy
    Participant
    January 26, 2016 at 00:52

    Hello,

    Ok thank you, I put the value “4” in “post per page” but I still have 5 related products displayed…

    Avatar: Eva
    Eva Kemp
    Support staff
    January 26, 2016 at 14:38

    Hello,

    Please provide us with FTP and wp-admin panel credentials in Private Content.

    Regards,
    Eva Kemp.

    Avatar: tlgv
    jeremy
    Participant
    January 26, 2016 at 19:29

    Hello,

    Please, contact administrator
    for this information.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    January 27, 2016 at 11:03

    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.

    Avatar: tlgv
    jeremy
    Participant
    January 27, 2016 at 19:53

    Everything’s ok, thanks a lot.

    Avatar: Eva
    Eva Kemp
    Support staff
    January 27, 2016 at 20:03

    Hello,

    You’re welcome.

    Regards,
    Eva Kemp.

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

The issue related to '‘Limit related products’' has been successfully resolved, and the topic is now closed for further responses

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.