I am working on Commerce 13.21.0. I am facing an issue where the cart total doesnt seem to be getting updated after overriding the LineItem calculator. I am overriding the CalculateExtendedPrice method of ILineItemCalculator to increase the extended price of a line item by $10 if a line item requires customization.
public class CustomLineItemCalculator : DefaultLineItemCalculator
public CustomLineItemCalculator(ITaxCalculator taxCalculator) : base(taxCalculator)
protected override Money CalculateExtendedPrice(ILineItem lineItem, Currency currency)
var price = base.CalculateExtendedPrice(lineItem, currency);
var option = lineItem.Properties[Constant.LineItem.TextOption] as string;
var message = lineItem.Properties[Constant.LineItem.CustomizationText] as string;
if (!string.IsNullOrWhiteSpace(option) && option == "Add custom text + $10" && !string.IsNullOrWhiteSpace(message))
var baseAmount = price.Amount;
price = new Money(baseAmount + 10, currency);
Above is the code, a straight forward override and I am also making sure that the CustomLineItemCalculator is registreted as the ILineItemCalulator implementation during initialization.
I can also see the extended price being computed properly in the DB:
But inspite of all this the cart total is still $170.
If I remember correctly you should also override the GetDiscountedPrice as that is used in calculating the orderfrm values
How do you register your CustomLineItemCalculator . Is it registered for Commerce Manager also?