How to remove related products from WooCommerce
In this tutorial we are going to look into the different ways you can remove the related products functionality from WooCommerce.
WooCommerce by default shows the related products widget on the single product page. Recommending related product in itself can be a very useful part of your cross-selling strategy. This is a the most basic form of cross selling and its almost universally used my most online stores. But also there are many situations when recommending related products might not be optimal for your WooCommerce store. For example:
- Your store might not have enough products to show useful related product recommendations
- Your store type and products you sell might not be well suited for related products recommendations
- The WooCommerce related product widget is not working properly or the recommendation are not good enough and you just want to get rid of it
WooCommerce does not make it easy to simply disable the recommended product feature but luckily there are quite a few different option to do it. Some of the options are going to be as simple as pressing a button or activating a plugin while other are a little bit more involved and might require some basic code knowledge. We’ll start with the more simple solutions.
Using your theme options
This is the most simple way to remove the related products but its very depended on the WordPress theme you are using. You see, if you are using dedicated WooCommerce theme its likely that the theme developers have created an option to disable the WooCommerce related products on single product page. Depending on your theme, this option is likely to be located under the single product page or somewhere in the themes options panel or the WordPress theme customizer panel. If this option is available in your theme options than its just a matter of disabling this feature from your themes’ settings.
From the WooCommerce dashboard
This method is not actually removing the related products recommendation by rather allowing you to have a complete control over what WooCommerce products will show in the related products widget.
You see, the related products recommendation algorithm in WooCommerce uses a variety of parameters in order to determinate what product to recommend. Since this is an automated process, we have no control over it. In order to take over the product recommendation decisions we need to activate the Cross selling option in WooCommerce. Cross selling products are linked together manually (by you) and give you complete control over what users will see under the related products.
Installing Plugin to remove the related products
If you don’t want to deal with code and prefer to just install a plugin to do the job for you that you might consider the NS Remove Related Products WordPress Plugin. This is a completely free plugin that does the job. All you have to do is install and activate the plugin. Once active, in the plugin settings page you just need to check the ‘Enabled Plugin” option and click Save Changes. This will automatically remove the related products form your WooCommerce store.
Using PHP Code snippet
Since some WooCommerce themes may not provide an out of the box option to control the related products recommendations, you might need to remove the recommended products by using a code snippet.
The code snippet can be added 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. It’s important that you add the code to your child theme and not your actual theme as adding custom code directly to your parent theme’s functions.php file will be deleted the next time when you update the theme.
* Remove related products output
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
This code snippet should disable the related products from showing up. In fact, this code actually removes the related products action from being run on the page all together.
Using CSS code
You can also use CSS to hide the related products output. You just need the bellow CSS code snippet that you can put in your customizers’ “Additional CSS” view. Alternatively if your theme option has a dedicated section to add custom CSS you can add it in there. The CSS code you need is:
Generally this is not the recommended way of hiding related products as this CSS snippet is just hiding the related products from the website visitors. The actual PHP code is still running in the background and its still loading all the recommended products data. But the truth is it works and easy to do for non-tech users.
There are many reasons why you might not want to display the related products WooCommerce widget. It’s possible you want to replace it with something of your own making or simply remove it altogether to improve the shopping experience. Thankfully, there are quite a few ways to remove the recommended products and we have looked into the different methods with different complexity. We hope you found this article useful.