To show related products on the product page, go to Products > Settings > General Settings and find the Show Related setting inside the Categories Settings section.
The related products are shown at the bottom of product pages when you switch the Show Related setting to Products. They are picked at random from the categories of the viewed product. You can also choose Categories to show the product’s categories instead, or Nothing.
The plugin automatically uses the default product listing template selected in the Catalog Design tab.
Custom Number of related products
The number of related products is by default limited to one row. You can adjust this by placing the following code into your theme functions.php:
add_filter('related_products_count','my_related_products_count');
function my_related_products_count($count) {
return 2;
}You can adjust the value returned to your needs.
Show more related products in one row
If you want to still show only one row but more products you can create a custom related-products.php template. See templates docs for details.
When you create a custom template, replace the following line:
echo do_shortcode( '[show_products post_type="' . $related_post_type . '" product="' . $products . '" sort="0"]' );With:
echo do_shortcode( '[show_products post_type="' . $related_post_type . '" product="' . $products . '" sort="0" per_row=5]' );This will show 5 products in one row. You can adjust the parameter to your needs.
Related products in other places
You can also show related products with the [related_products] shortcode (use the limit attribute to set the number), the Related Products widget or the Related Products block. See All Product Catalog Shortcodes and All Product Catalog Blocks.
