Hi,
We are currently working with web api for managing the basket, however, we are facing some issues in getting the discount correct, or at least it feels a bit messy and does not work proberly with vouchers.
What we do is the following:
1) Manipulate the orderlines, e.g. add orderline and trigger order line added notification
2) Recalculate the cart with the following code:
// We need to save the cart first in order to calculate discounts // This needs to be done as discounts puses ParentLineId, which is first generated upon save cart.Save(); // find force recalculate protected field var field = cart.GetType().GetProperty("ForceCalculate", BindingFlags.Instance | BindingFlags.NonPublic); if(field != null) field.SetValue(cart,true); cart.ForcePriceRecalculation(); cart.CalculateDiscounts();
Any tips to making this better and making vouchers work?
Best Regards
Søren