Round GrandTotal

Is there any way to round the GrandTotal?
I have tried to override the value in OrderTotalCalculator.CalculateFromCarrier but it still has decimals when created in Litium.

public class OrderTotalCalculator : Foundation.Modules.ECommerce.Plugins.Orders.OrderTotalCalculator
    {
        public override void CalculateFromCarrier(OrderCarrier orderCarrier, SecurityToken token)
        {
            base.CalculateFromCarrier(orderCarrier, token);
            orderCarrier.GrandTotal = RoundPrice(orderCarrier.GrandTotal);
        }

        private decimal RoundPrice(decimal price)
        {
            return Math.Round(price);
        }
    }

Anyone having a suggestion?

Litium version: 5.5.1

You should not send rounded order-total to payment provider.

We want to change both the value on the order and the value we send to the payment provider.
This is a request from our customer.

Try inheriting Litium.Foundation.Modules.ECommerce.Plugins.Orders.OrderGrandTotalCalculator instead.

Seems to be working!

Thank you @marten

I’m not sure but it can be good to check with Skatteverket if it is legal to round of the order/payment amounts like that. Example when you buy with card in Sweden the amount is not rounded of by the shop and instead you pay the cents also.

Will pass this on to the customer @patric.forsgard