How to hide related products on the WooCommerce product page
How to hide related products on the WooCommerce product page

Related Products is a great eCommerce feature. It helps customers to get product recommendations based on the product they purchase. It is nice when you see a cool shoe that matches with the dress you want to purchase, additional accessories for the new camera, or a beautiful case for the new smartphone.
For online stores, it is a proven tactic to increase average order value and boost profit.
However, this feature may not function as effectively as expected in all online stores. In some eCommerce websites, this may even negatively affect sales. For example, showing alternative products under the related product sections may confuse the buyers and they will hold back from the purchase.
Under such circumstances, you will need to remove the related products section form your online store. So, in this blog, we show you how to hide related products in WooCommerce stores.
How to hide related products on the WooCommerce product page
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.
- 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.
- 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.
- 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.
- 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.
- 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.