This is how you change the number of columns for similar products.

Marc Wagner, July 22, 2022

You can simply change the number of products that are displayed via a plugin or with PHP.

Since only a small code snippet is needed for the change, it is recommended to implement the whole thing with PHP.

In the Functions.php of your Child Theme, you can insert the following code to influence the number and columns:

/**
 * Change number of related products on product page
 */
function related_products_columns( $args ) {
   $args['posts_per_page'] = 4; // 4 related products
   $args['columns']        = 4; // arranged in 4 columns

   return $args;
}

add_filter( 'woocommerce_output_related_products_args', 'related_products_columns' );

That was it. Now you can customize your selection according to your wishes.

Avatar of Marc Wagner
Marc Wagner

Hi Marc here. I'm the founder of Forge12 Interactive and have been passionate about building websites, online stores, applications and SaaS solutions for businesses for over 20 years. Before founding the company, I already worked in publicly listed companies and acquired all kinds of knowledge. Now I want to pass this knowledge on to my customers.

Similar Topics

Comments

Leave A Comment

Title