To check the parent category in the product

Check the parent category of a product.

if(!function_exists('awdrcheckParentCategory')){
function awdrcheckParentCategory ($categories){
	foreach($categories as $id) {
            if ($term = get_term($id)) {
                if ($parent_id = $term->parent) {
                    if (!in_array($parent_id, $categories)) {
                        $categories = array_merge($categories, awdrcheckParentCategory(array($parent_id)));
                    }
                }
            }
        }
        return array_unique($categories);
   }
 add_filter('advanced_woo_discount_rules_get_product_categories','awdrcheckParentCategory', 10, 1);  
}