Show more or fewer related products on product pages, and set how many columns they use.
add_filter( 'woocommerce_output_related_products_args', function ( array $args ): array {
$args['posts_per_page'] = 3; // How many products.
$args['columns'] = 3; // How many per row.
return $args;
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
WooCommerce shows four related products by default. If your layout fits three across, or you want a longer row, this snippet changes the count and the columns.
The woocommerce_output_related_products_args filter receives the arguments WooCommerce uses to fetch and display related products. posts_per_page sets how many to show and columns sets how many per row.
Open a product page and count the related products.