Show only products of the same category in related products
-
Hello,
I’m having problems trying to get Woocommerce to ignore product tags when pulling related products to show on a product page. We have four main categories in our store: European Antiques, Classical Furniture, Lifestyle Furniture, and Nostalgia Decoration. Products under European Antiques show up as related products under Lifestyle Furniture due to tags, for example. I’m ok with related products coming from the parent category or the sub-category they are in but I need the tags to be ignored.
I’ve tried the code listed below but they haven’t helped much.
add_filter( 'woocommerce_get_related_product_tag_terms', function( $term_ids, $product_id ){ return array(); }, 10, 2 );
and
add_filter( 'woocommerce_product_related_posts_relate_by_tag', '__return_false' );
Is there anything else I can try or should that code work?
- The topic ‘Show only products of the same category in related products’ is closed to new replies.