Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
with the new abstraction APIs, you don't save the TaxTotal, you "calculate" it. So you can use IOrderGroupTotalsCalculator to get the tax values back (provided you implement ITaxCalculator to calculate taxes through your preferred service).
In Commerce 12, the values will be cached, so Commerce will save tax values for you internally.
I'm calling the IOrderRepository method Save that takes an IOrderGroup, but the TaxTotal amount I update is not persisting to the database.
Here is a code snippet (pulled from many methods to be concise)...
var purchaseOrder = _orderRepository.Load(orderId); var order = purchaseOrder as OrderGroup; if (order != null && taxResult?.TotalTaxes != null) { order.TaxTotal = taxResult.TotalTaxes.MoneyValue; // I see this get set to a dollar amount } if (order != null) { var orderGroup = order as OrderGroup; if (orderGroup == null) { result = _orderRepository.Save(order); } else { // at this point, I still see the dollar amount set above result = _orderRepository.Save(orderGroup); // this is the code path that gets executed } }
End result is a TaxTotal of 0.0 in OrderGroup table. This is driving me crazy. Any help will be appreciated.