As you probably know, WooCommerce shows related products in the single product page and retrieves automatically them filtering products in the same categories and tags of the shown product.
This is a great feature in my opinion, but can be a double-edge sword when you have a lot of tags and/or categories in your shop, which ends to show unrelated products.
But the developers were smart and included two filters to allow you to filter by categories only or by tags only.
Open your functions.php file in wp-content/themes/your-theme-name/ and add this code at the end of the file:
The first snippet hides products by tag, while the second does the same for categories.
Obviously don’t use both of them together or you will not see any related products.
Leave a Reply