My product_cat named 'test'. I am looking to get the ID of the category with the same name 'test'.
Code I'm using
$cate_object = get_the_terms( $post->ID, 'product_cat' );
foreach( $cate_object as $cate ){
// get cat id by tax name
$thisCatName = $cate->name;
$thisCatID = get_cat_ID($thisCatName);
if($thisCat !== null && $thisCat != 0)
$cat_array[] = $thisCatID;
}