Virtual Happy Hour is canceled this month (March) due to Good Friday.
Try our conversational search powered by Generative AI!
AI OnAI Off
Virtual Happy Hour is canceled this month (March) due to Good Friday.
EPiServer.Commerce 13.24.0
EPiServer.Commerce 13.26.0
Sep 24, 2020
Nov 25, 2020
Closed, Fixed and tested
For the multiple order forms in cart as below code, the CreateOrderForm() are returning same OrderFormId (-2)
var orderRepository = ServiceLocator.Current.GetInstance<IOrderRepository>(); var orderGroupFactory = ServiceLocator.Current.GetInstance<IOrderGroupFactory>(); var currentMarket = ServiceLocator.Current.GetInstance<ICurrentMarket>(); ICart cart = orderRepository.LoadOrCreateCart<ICart>(CustomerContext.Current.CurrentContactId, "Default", currentMarket); if (cart != null) { orderRepository.Delete(cart.OrderLink); } cart = orderRepository.LoadOrCreateCart<ICart>(CustomerContext.Current.CurrentContactId, "Default", currentMarket); cart.Forms.Remove(cart.GetFirstForm()); // We always remove the form provided by default form in a new cart as we need to populate all order forms with a bunch of custom property values later on. cart.Forms.Add(orderGroupFactory.CreateOrderForm(cart)); // Expected orderformid is -2, which it is orderRepository.Save(cart); cart = orderRepository.LoadOrCreateCart<ICart>(CustomerContext.Current.CurrentContactId, "Default", currentMarket); cart.Forms.Add(orderGroupFactory.CreateOrderForm(cart)); //Expected orderformid is -3 which it is in 13.18.2, but in 13.24.0 this is assigned -2 which leaves us with two order forms with the same id cart.Forms.Add(orderGroupFactory.CreateOrderForm(cart)); // 13.18.2 assigns -4 and 13.24.0 assigns -3, here the incrementation seems to be working again
source: https://pastebin.com/3e48Lihr