A comprehensive database for everything WordPress related.

TOP
WPKlik Logo Newsletter

Sign up and receive a free copy of How to Create an online Store with WooCommerce (full guide)

How to Remove Related Products in WooCommerce

How to Remove Related Products in WooCommerce

Inspiring your customers to add more items to their cart is always a good idea, and adding related products to your product pages has proven to be one of the most efficient ways to do so. Related products are the products that show up on the product detail page and are usually complimentary or similar to the featured product. WordPress themes often have a default recommended product section and in case they don’t you can always add this feature with the help of an appropriate plugin. There are two more types of related products that come with WooCommerce default options. They do not show up automatically and in case you don’t need them you simply don’t add them.

But how do you remove related products that are automatically added to your product page?

Related products wordpress

But how to remove related products in WooCommerce that are automatically added to your product page? No need to worry, this is also possible. In this article we will take you through each of the three methods for removing related products from your product page:

How to Remove Related Products in WooCommerce Using Theme Options

Before you jump to any other method, make sure to check whether the theme already has the option for enabling/disabling related products. This goes both for free and premium themes.

How to Remove Related Products with the Appropriate Code

There is code that can be added to prevent the related section from being displayed. Users usually add codes to the function.php file on the parent theme itself (Appearance > Theme Editor > function.php). This is not the best way because it can happen that by updating the theme, this code is deleted as it is no longer valid and it would be necessary to add it again. The best way to add code is to add it in the child theme’s functions.php file.

/** 
* Remove related products output 
*/ 
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

In case you don’t have a child theme or simply don’t feel confident enough to change anything in it, you can add code by using a plugin. Based on our experience the Code Snippets plugin is an excellent choice.

Code Snippets plugin

Adding code with this plugin is very simple. What is important for you to know is that there is no danger that your lack of experience in these matters can damage any PHP file when you use a plugin like this one. After the plugin installation and activation, find Snippets in the admin board and choose the Add new option.

Add New Snippet code

Now, all you need to do is simply assign the name and add code. Remember to click on Save Changes and Activate. Your setting will be immediately active and the theme update will not affect it in any way.

The great thing about this plugin is that you can simply delete or add it as per your need, or you can also choose to activate/deactivate it whenever you find it necessary.

How to Hide the Related Products Output

Another way to keep this section from showing is to hide it. This involves adding a couple of simple lines of CSS code. Again, there are several ways to add this code. Most often we add CSS in your customizers “Additional CSS” view (Appearance > Customize > Additional CSS) but we recommend that you add this code via the mentioned plugin.

.related.products 
{ display: none; 
}

The default code that this code recognizes is PHP, so in the case of adding CSS as is the case here, you need to add the code in a slightly different yet equally simple way.

When you go to All Snippets you will notice examples for different types of snippets depending on the type of code (HTML, CSS, JavaScript). We do not recommend that you change these snippets directly, it is best to always keep them as they are.

CSS Snippet

What you can do is go to Edit and look at the code structure. You will see the part that is intended to be added, in our case the CSS code. You need to copy all this code and add a new snippet and the desired code in it. This way, the example from the plugin will remain forever as a clear reminder of how to insert a certain type of code.

Css Snippet example

Another even easier way is to clone the sample code. That way the example is duplicated and what you need to do in this case is to go into the copy and change the name and add the code.

Css Snippet example

Cloning is often used for duplicating pages in WordPress. But, as you can see, cloning is an excellent solution in the case of codes too. It enables you to make a copy of the code quickly and then make the adjustments that you need on it.

In Conclusion

Although usually, it is recommendable to add related products to your pages, sometimes they can actually jeopardize sales by making customers overthink about their choices and possibilities. If, for example, a customer sees a cheaper alternative for the product they are interested in, they may immerse themselves too much into exploring other options or comparing the products which then leads them to leave your site and abandon the cart. This is only one of the reasons you may want to remove the related products section. Maybe you simply want to focus all the attention on one, featured product and boost its sales, or the customers in your niche don’t react well to related product suggestions. Whatever the reason, you can be sure that there surely is a way to add a customized related products section as well as to remove the related products section completely from your website.

What is your experience with the related products section? Feel free to share your thoughts, questions, and experiences with us in the comments section, we look forward to hearing from you!

Newsletter

WordPress perfection at your fingertips.

If you enjoyed this article, feel free to subscribe to our newsletter using the form below. You can also follow us on Facebook and Twitter and subscribe to our YouTube channel for WordPress video tutorials.

Leave a Reply