Filter Category Combination

Create a feature to filter combinations of categories.

  add_filter('advanced_woo_discount_rules_filter_passed', function($filter_passed, $rule, $product, $sale_badge){
            //'array(23,24)' - give rule id as you needed
            if(in_array($rule->getId(),array(23)) && class_exists('\Wdr\App\Helpers\Woocommerce')){
                $rule_filter = $rule->getFilter();
                $product_id = \Wdr\App\Helpers\Woocommerce::getProductId($product);
                $categories = \Wdr\App\Helpers\Woocommerce::getProductCategories($product);
                $category_id = array();
				$is_product_in_category = false;
                if($rule_filter){
                    foreach($rule_filter as $filter){
                        $type = isset($filter->type) ? $filter->type : '';
                        if( $filter->method == 'in_list'){
                            if($type == 'product_category'){
                                $category_id = isset($filter->value) ? $filter->value : array();
                            }
                        }
                    }
                }
               
                if(!empty($category_id) ){
                    foreach ($category_id as $cat_id){
                        if(in_array($cat_id, $categories)){
							$is_product_in_category = true;
						}else{
							return false;
						}
                    }
					if($is_product_in_category){
						return true;
					}
                }
            }
            return $filter_passed;
        }, 10, 4);