In Single product page, by default WooCommerce display 2 and 1 for related products but if you want to display more product in related product than how to do this. So here is solutions. let’s have a look. Add below line of code in your theme’s functions.php file of your active child theme (or theme) and save the file.
add_filter( 'woocommerce_output_related_products_args', 'wdo_change_number_related_products', 9999 ); function wdo_change_number_related_products( $args ) { $args['posts_per_page'] = 4; // # of related products $args['columns'] = 4; // # of columns per row return $args; }
To do this, also add below css code in your style.css file of of your active child theme (or theme) and save the file.
@media (min-width: 768px) { .site-main .related.products ul.products li.product { width: 22%; float: left; margin-right: 4%; } }