I'm trying to figure out the php syntax here, so I can show only related products that are of the current taxonomy term. I would like the $args filter 'product_brand' to dynamically grab the current products term.
So I need a method of getting the slug for the current product term. I've tried this but it's not working, and is returning more than one term.
$mjrelatedproducts = get_brands( $post->ID )->slug;
$args = apply_filters('woocommerce_related_products_args', array( 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'product_brand' => $mjrelatedproducts, 'no_found_rows' => 1, 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, 'post__in' => $related, 'post__not_in' => array($product->id) ) );