This download folder contains 3 code snippets which enable you to exclude or remove WooCommerce products from your Related Products list. You can exclude by :
- Product ID
- Category Slug
You might want to use this code to remove “Out of Stock” products from your related products list unless you’re offering them on back order.
What Are Related Products
Related Products are products that share the same tags or categories as the current product. They are not the same as “Up-Sells” or “Cross Sells” which you add manually in Product Data – Linked Products.
Copy & paste ( without the opening PHP tag ) one or more of the snippets to the end of your child themes functions file or custom functionality plugin.
A 4th method has been tested and added to the latest download folder.