November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Have you tried creating your own ITaxCalculator?
https://world.episerver.com/documentation/developer-guides/commerce/orders/calculating-orders-intro/calculating-orders-tax-calculator/
The order handling is setup so that different Calculators has the logic that creates the totals that are saved on the PurchaseOrders, they are automatically called by episerver so you can't modify the totals yourself.
purchaseOrder.AcceptChanges();
_orderRepository.Save(purchaseOrder);
both those lines save the order, only one is needed. I think you should remove AcceptChanges() and try again
Hi Quan,
I have tried the following:
var orderReference = _orderRepository.SaveAsPurchaseOrder(cart);
var purchaseOrder = _orderRepository.Load<PurchaseOrder>(orderReference.OrderGroupId);
purchaseOrder.TaxTotal -= taxAmount;
purchaseOrder.Total -= taxAmount;
_orderRepository.Save(purchaseOrder);
Which still reverted the amount.
I also tried:
var orderReference = _orderRepository.SaveAsPurchaseOrder(cart);
var purchaseOrder = _orderRepository.Load<PurchaseOrder>(orderReference.OrderGroupId);
purchaseOrder.TaxTotal -= taxAmount;
purchaseOrder.Total -= taxAmount;
purchaseOrder.AcceptChanges();
Which seemed like it had saved the amount but when checking the order in commerce manager the amount has somehow still reverted :(.
I am going to double check if its being saved again further down the line.
For flat rate markets we store prices without tax in the catalog. We calculate the tax when the price is loaded whenever a user visits a product page. This has caused us to do some extra calculations when using the fixed price promo as the badge that gets shown does not tax into account the tax. We are able to update this value in the badge fine but we have noticed some other issues.
The purchase order still retains the tax of the discounted items which we would like to remove. I have tried the following:
var orderReference = _orderRepository.SaveAsPurchaseOrder(cart);
var purchaseOrder = _orderRepository.Load<PurchaseOrder>(orderReference.OrderGroupId);
purchaseOrder.TaxTotal -= taxAmount;
purchaseOrder.Total -= taxAmount;
purchaseOrder.AcceptChanges();
_orderRepository.Save(purchaseOrder);
After AcceptChanges() the value is still correct but when I call Save the value reverts. Is there a way to stop it reverting on Save?