WooCommerce PHP – If Product Category Has Children [duplicate]

You can get all child category by using parent category id, I am using this code for access child product category

$cat_id = 1; // A Category id 
$temp_terms = get_terms(array(
   'taxonomy' => 'product_cat',
    'parent' => $cat_id,
    'order_by' => 'name',
));