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’.

Our team at Themelocation is comprised of WordPress developers of high expertise

  • We can maintain, support and manage your single, or all your clients, website with dedication
  • Our skills are at your disposal.

Book a Call

woocommerce

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

woocommerce

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.

woocommerce

CHEER SJ

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

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