Vulnerability in EPiServer.Forms
using the IOrderSearchService we run reports for specific time periods and during some of those time periods we have sales and if the cart total is above 200 the customer gets free shipping.
We've noticed sometimes that the Total Revenue is sometimes less than the sub total. Does anyone know how that's possible?
code snippet below
var orderFilter = new OrderSearchFilter
CreatedFrom = data.StartDate,
CreatedTo = data.EndDate.AddDays(1)
var orderSearchService = ServiceLocator.Current.GetInstance<IOrderSearchService>();
var searchResult = orderSearchService.FindPurchaseOrders(orderFilter);
completedTotalRev = searchResult.Orders.Sum(x => x.GetTotal()); //Sometimes lower than completedSubTotal
completedSubTotal = searchResult.Orders.Sum(x => x.GetSubTotal());
Thank youCommerce 188.8.131.52
bumping. anyone have any ideas? bug maybe?
I believe getTotal is calculated by:
Total = subTotal + handlingTotal + ShippingSubTotal - OrderDiscountTotal - ShippingDiscountTotal
Lets say you have 3 orders of $200 and shipping discount of $20.
200+200+200 = $600 subtotal
200+ 200 + 200 - 20 - 20 - 20 = 540 total?
So ShippingDiscountTotal is messing up with the calculations?
Yea the subtotal doesn't include discounts while the total does that's why it was showing like that.