
WooCommerce picks related products on the Single Product Page based on product categories and/or product tags. Related products are very important to the shopping experience, and sometimes this is not enough – what if you want to automatically show certain products based on different criteria?
So, here’s a quick snippet to e.g. get related products with the same product title of the current one. A very strange example, but you can use this as reference in case you want to get products based on different criteria.
The get_posts() function, in fact, can be customized to get products with a given stock, specific price range, same custom field value, search term, and so on.
Continue reading WooCommerce: Custom Related Products