title: how to get current product category name in woocommerce
body: <p>In WooCommerce single produce page I'm using some custom fields but one tab (see attachment picture right side tab 'Residential') I'd like to get the product category, which only one will be ticked. But I'm very unsure what code is needed to get that?</p>
  <p>Image: <a href="https://ibb.co/XJ7FvmT" rel="nofollow noreferrer">https://ibb.co/XJ7FvmT</a></p>
  <p><a href="https://i.stack.imgur.com/1iJqd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1iJqd.png" alt="enter image description here" /></a></p>
  <p>Any help to extract one product category name would be much appreciated.</p>
  <p>The product (a property) will only have one category. Ie. Land, Residential, Commercial, Industry etc.</p>
  <p>Thanks</p>
  <p>Here is some code from image that's from the add_action in functions.php</p>
  <pre><code>    &lt;!-- Advanced Custom Feilds--&gt;            
  &lt;span class=&quot;property-contract-badge&quot;&gt;&lt;?php echo get_field('listing_status'); ?&gt;&lt;/span&gt;
  &lt;span class=&quot;property-type-badge&quot;&gt;&lt;?php echo get_field('property_category'); ?&gt;&lt;/span&gt;
  
  &lt;!-- Get Woocommerce product category --&gt;        
  &lt;span class=&quot;property-type-badge&quot;&gt;&lt;?php echo $product-&gt;get_the_terms( $post-&gt;ID, 'product_cat'); ?&gt;&lt;/span&gt;
  </code></pre>