0
votes

I have done a fair bit of searching on this but to no avail.

My question is that i wish to narrow the term by which woocommerce defines a related product. It currently uses Categories & Tags to define related products, but i wish to remove tags and just link by product categories. The result of this would be only products in my store with the same category would be defined as a related product. Note i am not using subcategories.

Can someone help me out with the code i would need to use to achieve this?

Thanks!

1

1 Answers

-1
votes

In the abstract-wc-product.php file in the woocommerce/includes/abstracts/ folder remove the following line (on line ~1154):

// Get tags
$terms = wp_get_post_terms( $this->id, 'product_tag' );
foreach ( $terms as $term ) {
    $tags_array[] = $term->term_id;
}

Removing the above should work.