Fix - Rule applied messages shown incorrectly

Correct the display of messages indicating applied discount rules.

// Re-initialize $applied_rules static variable before calculate totals
add_action('woocommerce_before_calculate_totals', function () {
    if (class_exists('Wdr\App\Router')) {
        $manage_discount = Wdr\App\Router::$manage_discount;
        if (is_object($manage_discount)) {
            $calc = $manage_discount::$calculator;
            $calc::$applied_rules = array();
        } 
    }
});

Last updated