Update cart while using custom price calculator

Hi

We are using a custom price calculator for logged in users but if cart already contains item before logged in then that price doesn’t updates with the new price from the custom price calculator.
We are overriding from IPriceCalculator.

Litium version: 7.7

I suppose you are using the service decorator pattern as described here:

in your custom implementation, would you try calling the default implementation to calculate the prices first, then use your modifications and try?

so you would get code like, _parent.GetListPrices(…)
would this solve the issue?

Yes, the code looks almost like this: Education/Developer Education/Tasks/Pricing rules/Resources/ERPPriceCalculatorDecorator.cs at litium-7 · LitiumAB/Education (github.com)
Parent method is only called if user is not authenticated. But the issue is that if I already have items in my cart and then authenticate (login as B2B) the prices in the cart are not updated with the prices im trying to fetch from the ERP.

We could use _cartService.CalculatePrices(); in the login controller to recalculate prices in cart, but im wonder if this is the best practice or if there is another better solution.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.