Thanks. I found that article, but it didn't seem to work for me. I've tried your code but there's an error:
Your PHP code changes were rolled back due to an error on line 204 of file wp-content/themes/thegem/inc/woocommerce.php. Please fix and try saving again.
Cannot redeclare thegem_woocommerce_output_related_products_args() (previously declared in wp-content/themes/thegem-child/functions.php:26)
When I look open woocommerce.php in thegem/inc and look at line 204 that that's indeed the line to set the number of posts and columns for the related products. I can change it there and that will work, but I'd obviously rather add a line in my functions.php in my child theme. Or would it be an option to put a woocommerce.php file with this code in a thegem-child/inc folder, to prevent it from rolling back after an update?
Hi,
Is there an option to set the number of related products shown at the bottom of a product page? Now there are 6 but I want to change that to 4.
Thanks!
Hi,
Please read this article - https://docs.woocommerce.com/document/change-number-of-related-products-output/.
Our theme use this hook:
You can try to change this with same code in child theme.Hi Max,
Thanks. I found that article, but it didn't seem to work for me. I've tried your code but there's an error:
Your PHP code changes were rolled back due to an error on line 204 of file wp-content/themes/thegem/inc/woocommerce.php. Please fix and try saving again.
Cannot redeclare thegem_woocommerce_output_related_products_args() (previously declared in wp-content/themes/thegem-child/functions.php:26)
When I look open woocommerce.php in thegem/inc and look at line 204 that that's indeed the line to set the number of posts and columns for the related products. I can change it there and that will work, but I'd obviously rather add a line in my functions.php in my child theme. Or would it be an option to put a woocommerce.php file with this code in a thegem-child/inc folder, to prevent it from rolling back after an update?
You need to use code like this: