545
A WC product may belong to none, one or more WC categories. Supposing you just want to get one WC category id.
There are two parameters of get_the_terms function.
global $post; $terms = get_the_terms( $post->ID, 'product_cat' ); foreach ($terms as $term) { $product_cat_id = $term->term_id; break; }