Discounts are not applied correctly in Checkout page when Country Based Restrictions for WooComme

Fix discount application issues on the checkout page with country-based restrictions.

add_action('woocommerce_review_order_before_cart_contents', function() {
    if (function_exists('WC')) {
        if (isset(WC()->cart) && WC()->cart != null) {
            if (method_exists(WC()->cart, 'calculate_totals')) {
                WC()->cart->calculate_totals();
            }
        }
    }
}, 100);