# Exclude discount of specific rules if b2b customer is logged in

```php
// To exclude discount of specific rules if b2b customer is logged in
global $awdr_global_filter_passed;
add_filter('advanced_woo_discount_rules_filter_passed', function($bool, $rule) {
    global $awdr_global_filter_passed;
    $rule_id = is_object($rule) && method_exists($rule, 'getId') ? $rule->getId() : null;
    $rule_ids = [17]; // here you can add multiple rule ids to exclude discount for b2b customer
    if (in_array($rule_id, $rule_ids)) {
        if (!isset($awdr_global_filter_passed)) {
            $awdr_global_filter_passed = true;
            if (function_exists('get_user_meta') && function_exists('get_current_user_id')) {
                if (get_user_meta(get_current_user_id(), 'b2bking_b2buser', true) === 'yes') {
                    $awdr_global_filter_passed = false;
                }
            }
        }
        if ($awdr_global_filter_passed === false) {
            return false;
        }
    }
    return $bool;
}, 100, 2);
```
