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
- Key
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.
Installation
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.
Bonus
A 4th method has been tested and added to the latest download folder.
Was This Tutorial Helpful?