title: Get WooCommerce product categories from WordPress
body: <p>I am trying to get the product categories from WooCommerce through a function in  my WordPress theme</p>
  
  <pre><code>    function get_me_list_of($atts, $content = null)
      {   
          $args = array( 'post_type' =&gt; 'product', 'posts_per_page' =&gt; 10, 'product_cat' =&gt; $atts[0]);
  
          $loop = new WP_Query( $args );
  
          echo '&lt;h1 class="upp"&gt;Style '.$atts[0].'&lt;/h1&gt;';
          echo "&lt;ul class='mylisting'&gt;";
          while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); 
          global $product; 
  
          echo '&lt;li&gt;&lt;a href="'.get_permalink().'"&gt;'.get_the_post_thumbnail($loop-&gt;post-&gt;ID, 'thumbnail').'&lt;/a&gt;&lt;/li&gt;';
       echo '&lt;li&gt;&lt;a href="'.get_permalink().'"&gt;'.$loop-&gt;post-&gt;post_title.'&lt;/a&gt;&lt;/li&gt;';
  
  echo '&lt;li&gt;&lt;a href=""&gt;'.get_categories().'&lt;/a&gt;&lt;/li&gt;';
          endwhile; 
  
          echo "&lt;/ul&gt;";
  
          wp_reset_query(); 
  
  
      }
  
      ?&gt;
  </code></pre>
  
  <p>The above code returns some products, but the product categories.</p>
  
  <p>When I included <code>echo '&lt;li&gt;&lt;a href=""&gt;'.get_categories().'&lt;/a&gt;&lt;/li&gt;';</code> in the code above it returns as an array. How do I fix this?</p>
  
  <p>How do i change this to get the product categories from WooCommerce?</p>