Is Child Category of Woocommerce
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
function get_wc_child_arr($parentID,$categoriesIDsArr){
$isExist=false;
$arr=get_wc_subcategories($parentID);
$tmpArr=array($parentID=>$parentID);
foreach ($arr as $key => $value) {
$tmpArr[$value['term_id']]=$value['term_id'];
}
foreach ($categoriesIDsArr as $key => $value) {
if(isset($tmpArr[$value])){
$isExist=true;
}
}
return $isExist;
}
//<<<