In SectionProductsViewModelBuilder in the accelerator code, we ask for the cart’s currency. For some reason, Litium’s cart will in this situation trigger a recalculation of the cart, which in turn will make calls to the various “calculators”. One of the calculators is the FeesCalculator, which we have overridden with our own implementation. One of the things that we need in our implementation is the currency of the cart, so we make a call to CurrentState.Current.ShoppingCart.Currency. This will trigger a new recalculation in Litium and we eventually end up in a stack overflow.
I think this is a bug in the platform and I will report it to Litium’s support. But until it has been solved, does anyone know of a way to work around the problem?
Litium version: 6.1.1
In the factories that is used for the order calculations the OrderCarrier
is included in the method call. The OrderCarrier
have the CurrencyID
property that contains the currency system id. This property can be used to fetch the currency from the currency service. If you call other services from the calculators you need to pass the currency/currencyid into that service, you can not expect that the cart that is stored in the session exists and not even that the calculator is running in a context that have an session, example in the callback from Klarna Checkout that should create the order when that is placed or when the prices is calculated for the price agent feed.
The calculators is called to create an empty shopping cart when it not exists and project can override the calculators to add default values.