The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Change WooCommerce Related Products Count

Shared by Amit Dholiya · September 10, 2026 · @posts_per_page

24 views
1 upvote
Back to Snippets

Control how many related products WooCommerce displays on the single product page.

Steps

  1. Add the code below to your theme’s functions.php.
  2. Change 4 to your preferred number.
  3. Save and refresh a product page.
/**
 * Change WooCommerce related products count
 */
function custom_related_products_args( $args ) {
    $args['posts_per_page'] = 4;

    return $args;
}

add_filter( 'woocommerce_output_related_products_args', 'custom_related_products_args' );
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments

Proudly supported by