Woocommerce Product Term
public function product_term($post_id=null, $arg='term_id'){
if(!$post_id) {
global $post;
$post_id = $post->ID;
}
$terms = get_the_terms( $post_id, 'product_cat' );
if(!$terms) return;
foreach ($terms as $term) {
if($arg == 'term_id') return $term->term_id;
if($arg == 'name') return $term->name;
break;
}
}