I am trying to get displayed related products based on specific product attribute "pa_kolekcja" term value (set on the product). I have a following piece of code (it's almost ready):
function woo_related_products_edit() {
global $product;
$current_kolekcja = "???"; // <== HERE
$args = apply_filters( 'woocommerce_related_products_args', array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => 4,
'orderby' => $orderby,
'post__not_in' => array( $product->id ),
'tax_query' => array(
array(
'taxonomy' => 'pa_kolekcja',
'field' => 'slug',
'terms' => $current_kolekcja
)
)
) );
}
add_filter( 'woocommerce_related_products_args', 'woo_related_products_edit' );
How I can get the current product attribute "pa_kolekcja" term value set on the product?