Woocommerce Get product tags in array

I had to parse an args-array to the get_terms function. Maybe this help other aswell.

$args = array(
    'number'     => $number,
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
    'include'    => $ids
);

$product_tags = get_terms( 'product_tag', $args );

global $product;
$tags = $product->tag_ids;
foreach($tags as $tag) {
   echo get_term($tag)->name;
}

You need to loop through the array and create a separate array to check in_array because get_terms return object with in array.

$terms = get_terms( 'product_tag' );
$term_array = array();
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
    foreach ( $terms as $term ) {
        $term_array[] = $term->name;
    }
}

So, After loop through the array.

You can use in_array().
Suppose $term_array contains tag black

if(in_array('black',$term_array)) {
 echo 'black exists';
} else { 
echo 'not exists';
}