In this tutorial, I’ll show you how to quickly remove the “Related Products” section from WooCommerce’s single product page.
Our Top Ranked #1 Web Host for WordPress Hosting
Latest Uptime Stats (Real Records):
Server Response Speed Test Scored A+:
I won’t use a plugin for this, only a line of code. The fewer plugins you have, the better!
This will completely remove the section from the source code, not just hide it, because you can do that as well with some CSS code.
But Google is not a big fan of hiding content, especially if it contains links.
It doesn’t mean that you’ll risk a penalty or something like that, but the best SEO practice is to completely remove sections and features, rather than hiding them.
Remove Related Products in WooCommerce
I recommend backing up your site and having a child theme in place, otherwise, the changes will disappear with the next theme update!
If you don’t have a child theme and don’t want to create one, use the Code Snippets plugin to add the code.
For my example, I’ll be using a child theme and cPanel.
Access your child theme’s folder to edit the
The file is normally found in:
Add the below code right at the bottom of the file or right before the
?> ending tag (if any).
/* Remove Related Products */ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
If the change doesn’t take place, clear your site and browser cache!
If the Related Products section is still not removed, it means that your theme is preventing the changes to take effect.
In that case, remove the previous code and use this one instead:
/* Remove Related Products */ add_filter('woocommerce_product_related_posts_query', '__return_empty_array', 100);
This should work with most, if not all themes. This one worked for me as well. The previous one didn’t.
Again, if needed, clear your site and browser cache!
That’s a Wrap
I hope you found this tutorial useful and you managed to remove the Related Products section from the WooCommerce single product page!
If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.
Don’t forget to share the post to help out others!