WooCommerce – Remove related products

How to remove similar products from the WooCommerce product page?

You want to delete related products from WooCommerce product page?

I’ll show you how to remove similar products from the WooCommerce product page without using a plugin. Only one line of code is required. The fewer plugins you use, the better the performance of your website!

With the line of code, the Related Products section (relatives or similar products) is completely removed from the source code and not just hidden.

While there are ways to hide this section, Google does not like hiding content. While you do not risk punishment by hiding such sections, from a SEO perspective, sections and features should be completely removed rather than simply hidden.

# Remove related products in WooCommerce

Before you make any changes to your files, make sure you back up your website or file. Even better is the practice of using a child theme, otherwise the changes will not be displayed in the next theme update!

If you do not have a child theme and do not want to create a theme, there is the alternative to insert the code with the code snippets plugin. Alternatively, this can also be a self-created plugin, in which you manage all your snippets centrally at best.

In the example below I use the Child Theme:

Step 1

Search the folder of your child theme to edit the file “functions.php”.

The file is usually located in the following directory:


Step 2

Add the following code directly to the end of the “functions.php” file or before the?> End tag (if any).

/* Remove Related Products */ 
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );     

If the change is not performed or visible, delete your browser cache!

If the “related products” section in WooCommerce single product view still does not get removed, your design / template may be blocking the changes.

There is another solution for this:

In this case, remove the above code from the “functions.php” and use the following code instead:

/* Remove Related Products */ 
add_filter('woocommerce_product_related_posts_query', '__return_empty_array', 100);   
JoeWP WordPress Agency - delete related products from WooCommerce
JoeWP WordPress Agency – delete related products from WooCommerce

This code should work on most themes.

Then delete your browser cache again!

That was already everything. You have achieved an effective result with little effort and without installing another plugin.

JoeWP WordPress Agency - Request

Would you like us to remove the “related products” from the WooCommerce product page?

Do you want to start right now? Discuss your project with us!