php – WooCommerce gets products based on taxonomy

I need to modify the WooCommerce product query because I want to filter the products shown on the pages of the store according to the taxonomies of each product. So what I have tried is this here:

add_filter (& # 39; woocommerce_product_query_meta_query & # 39 ;, & # 39; filter & # 39 ;, 10, 2);
function filter ($ meta_query, $ query) {
// Only on category pages
if (! is_product_category ()) {
returns $ meta_query;
}

$ tags_array[] = & # 39; ABCSD & # 39 ;;

$ meta_query[] = array (
& # 39; key & # 39; => & # 39; product_tag & # 39 ;,
& # 39; value & # 39; => $ tags_array,
& # 39; Compare & # 39; => & # 39; EXISTS & # 39;
);

returns $ meta_query;
}

So I just want to show all the products that have the ABCSD taxonomy.
The code is placed in my functions.php. What am I doing wrong here?