Hi @gemini23
Can related products be turned off?
I have seen the following but this simply just doesn’t display the related products, but they are still in the source code. .related.products { display: none; }
From what I understand, you’re looking to turn off the related products feature in WooCommerce, aren’t you? You’re correct in noting that the CSS code you’ve shared (.related.products { display: none; }
) only hides the related products from the front view, but doesn’t remove them from the source code.
To completely eliminate the related products from the source code, here’s a PHP code you can use:
/* Remove related products output */
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
Add this code to your child theme’s functions.php
file or via a plugin that allows custom functions to be added, such as the Code Snippets plugin. Remember, it’s not advisable to add custom code directly to your parent theme’s functions.php
file, as updates to the theme will erase it.
I hope this information helps. If you have any other questions or need further assistance, feel free to contact us. We’re here to help!