get category product woocommerce code example
Example 1: woocommerce get product id
global $product;
$product->get_id();
Example 2: woocommerce get post terms product
$term_obj_list = get_the_terms( $post->ID, 'taxonomy' );
$terms_string = join(', ', wp_list_pluck($term_obj_list, 'name'));
Example 3: is product category woocommerce
if( has_term( 4, 'product_cat' ) ) {
// do something if current product in the loop is in product category with ID 4
}