Change number of related products output Hook

To change the number of related products display in the detail page,use the following code in your theme’s functions.php file.

[code language=”php”]
add_filter( ‘woocommerce_output_related_products_args’, ‘sp_related_products_args’ );
function sp_related_products_args( $args ) {

$args[‘posts_per_page’] = 4; // 4 related products
$args[‘columns’] = 2; // arranged in 2 columns
return $args;


Sandeep Kumar

Sandeep kumar is a web developer and a professinal blogger. He works for latest technologies and write articles what he learn. In ICodeHub he share web languages tutorials and other programming tips and tricks. if you need some help or have some suggestion then mail him at sandeep92pal@gmail.com without any hesitation. He believes in learning and sharing.