0
votes

I'm trying to exclude products from two specific categories (fine watch, fine jewelry) from showing up in the related products on the content single products page. The closest idea I have stumbled upon is this code from a file named related.php in woocommerce\template\single-product\ :

$args = apply_filters('woocommerce_related_products_args', array(
'post_type'     => 'product',
'ignore_sticky_posts'   => 1,
'no_found_rows'     => 1,
'posts_per_page'    => $posts_per_page,
'orderby'       => $orderby,
'post__in'      => $related,
'post__not_in'      => array($product->id)
 ) );

Any idea how to modify this code or am I looking at the wrong thing?

1

1 Answers

0
votes

You are supposed to use

'post__not_in'      => array($product->id)