woocommerce how to get cat id in content-product.php

Use this

$product_terms = wp_get_object_terms( 17, 'product_cat', array( 'fields' => 'all' ) );

and then get the parent cat id and move all sub cat into an array.

tech