How to change number of related products being displayed on product page in Woocommerce?

Related products are being displayed on a product page on the basis of matching tags among products. By default woocommerce displays two related products.In this tutorial we’ll learn how to increase number of related products on a product page. To do this add some products with a matching tag.

I’ve created seven products with a tag in common i.e. ‘xyz’.


Now go to product page from front end. Initially it will display only two related products:


Now add the following lines of code at the end of your theme’s functions.php file:

function woocommerce_output_related_products() {

                woocommerce_related_products(array('posts_per_page' => 6, 'columns' => 2, 'orderby' => 'rand'));


Go to product page again and you’ll see 6 related products.



Editorial Staff

ThemeLocation Provides Wordpress & Woocommerce development & Customization services. Have a Project? Contact To discuss

Leave a Reply

Your email address will not be published. Required fields are marked *