# Compatible with WooCommerce Blocks By Automattic

```php
add_filter('advanced_woo_discount_rules_run_discount_rules', function ($run_rule, $cart_object){
    if (isset($cart_object->cart_contents) && !empty($cart_object->cart_contents)) {
        foreach ($cart_object->cart_contents as $key => $cart_item) {
            if(function_exists('file_get_contents')){
                $json = file_get_contents('php://input');
                $post_data = json_decode($json);
                if(!empty($post_data)){
                    if(isset($post_data->key) && isset($post_data->quantity)){
                        if($cart_item['key'] == $post_data->key){
                            if($cart_item['quantity'] != $post_data->quantity){
                                $run_rule = false;
                            }
                        }
                    }
                }
            }
        }
    }

    return $run_rule;
}, 10, 2);
```
