title: Woocommerce Get product tags in array
body: <p>I want to get the product tags of the woocommerce products in an array, for doing if/else logic with it (in_array), but my code doesn't work:</p>
  
  <pre><code>&lt;?php 
  
  $aromacheck = array() ; 
  $aromacheck = get_terms( 'product_tag') ; 
  // echo $aromacheck
  
  ?&gt;
  </code></pre>
  
  <p>When echoing $aromacheck, I only get empty Array, though the product tags are existing - visible in the post class. </p>
  
  <p>How can I get the product tags in an array correctly?</p>
  
  <p><strong>Solution (thanks Noman and nevius):</strong></p>
  
  <pre><code>/* Get the product tag */
  $terms = get_the_terms( $post-&gt;ID, 'product_tag' );
  
  $aromacheck = array();
  if ( ! empty( $terms ) &amp;&amp; ! is_wp_error( $terms ) ){
      foreach ( $terms as $term ) {
          $aromacheck[] = $term-&gt;slug;
      }
  }
  
  /* Check if it is existing in the array to output some value */
  
  if (in_array ( "value", $aromacheck ) ) { 
     echo "I have the value";
  } 
  </code></pre>