In Woocommerce single product pages, I am trying to exclude any product that starts with the character 'I' from appearing in related products. I tried the following in single-product/related.php
template file:
foreach($products as $product){
if (substr($product->post_title, 0, 1) === 'I') {
unset($product);
}
}
But I'm still missing something as It doesn't work.
How can I exclude products Ids which title start with the letter "I"
from related products?