Hide related product per category is hiding other categories
-
Hi,
I’m using the following code on woocommerce/templates/single-product/related.php to hide one category for being displayed on related products:
$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), 'tax_query' => array(array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'packs' ), // Don't display products in the packs category in related products 'operator' => 'NOT IN')) ) );
And is hiding all categories and not only the “packs” one. I’m doing something wrong?
By the way I’m making changes on the plugin file, I’ve tried to pars this code on functions.php of my child theme, but not working. Is there a way to use it there? or is better to use the hooks option?
Any help would be much appreciated
thanks
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Hide related product per category is hiding other categories’ is closed to new replies.