How to remove similar products from the 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.
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:
Search the folder of your child theme to edit the file “functions.php”.
The file is usually located in the following directory:
Add the following code right at the end of the file “functions.php” or before?>End-Tag (if available).
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:
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.