Hello frinds, welcome to my another blog how to change number of related products WooCommerce. If you build your eCommerce store with woocommerce and show your product page by default you see related products, below your main products. WooCommerce has default nature to show related products by category and tags. If you want to change number of related products and number of columns in WooCommerce, you need to write code. You do not have other options.

Change number of related products WooCommerce

Add the below code to your theme functions.php




add_filter( ‘woocommerce_output_related_products_args’, ‘custom_related_products_args’ );
function custom_related_products_args( $args ) {

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

Now you are done. You see the changes in your product page. Now you know how to change number of related products WooCommerce.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
How to change number of related products WooCommerce
Tagged on: