There are many different ways to remove the related products section on the WooCommerce single product page. You can use a plugin or you can write PHP code to remove the related products feature. Some WooCommerce themes allow store owners to enable and disable the related products feature with a toggle switch.

In this blog, we show you how to do it by adding a line of PHP code to the functions.php file in your theme. This is more efficient than using a plugin.

  1. Go to WordPress Theme Editor

Open the WordPress admin dashboard of your WooCommerce store and go to Appearance > Theme editor from the left sidebar.

This will take you to the WordPress theme editor screen. On this page, you can see the list files in your theme under Theme Files on the right side and a text editor in the middle of the screen.

  1. Open functions.php

Scroll down through the list of files under Theme Files to find the Theme Functions (functions.php) file. Once you find it, click on it to open it in the text editor in the middle of the screen.

Now functions.php file is opened on the text editor and you can make all the changes you want.

  1. Copy the following code snippet

Copy the following PHP code snippet.


remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

You need to add this code snippet to the functions.php file on the next step.

  1. Add the code snippet to functions.php file

Go back to the Theme Editor screen where you have the functions.php file opened in the text editor.

Click anywhere on the code and scroll to the bottom.

If you see ?> at the end of the code paste the above code snippet on a new line just above ?>.
If there is no ?>, then you can paste the above code snippet at the bottom.

  1. save-the-changes

Now you have added the code into the functions.php file in your theme to hide the Related Products section on the single products page in your WooCommerce store.

Click on the “Save Changes” button at the bottom of the text editor to save the changes you made. Once you click the button, the page will reload and you can see a success message. Now you are all set.

Summary

We hope that this blog helped you to hide the Related Products section in your WooCommerce store. If you have any trouble, don’t hesitate to get in touch with us.