Don't miss out Virtual Happy Hour this Friday (April 26).
Don't miss out Virtual Happy Hour this Friday (April 26).
May 29, 2017
Apr 13, 2018
Closed, Cannot Reproduce
When creating a new cart via OrderRepository.Create<ICart>(), the new Cart instantly appears in Commerce Manager.
But when trying to use OrderRepository.Load<ICart> in the CMS site, a new cart cannot be loaded.
After an IISReset, the cart appears.
Same issue occurs when trying to delete the cart by calling OrderRepository.Delete().
The cart is instantly removed from CommerceManager, but not from CMS.
1) Setup a Quicksilver site (Commerce 10.6.0).
2) Create a new cart by using this code snippet:
var orderRepository = ServiceLocator.Current.GetInstance<IOrderRepository>();
|
|
var cart = orderRepository.LoadOrCreateCart<ICart>(PrincipalInfo.CurrentPrincipal.GetContactId(), "Default"); |
|
//var lineItem = cart.CreateLineItem(entryCode); |
var lineItem = cart.CreateLineItem("P-36127195"); |
lineItem.Quantity = 1; |
lineItem.PlacedPrice = 100; |
lineItem.Properties["personalValue"] = "customValue ... "; |
|
var shipment = cart.GetFirstShipment();
|
shipment.LineItems.Add(lineItem);
|
|
orderRepository.Save(cart);
|
|
3) The cart appears in Commerce Manager and the table [SerializableCart].
4) In the Front end (CMS), load a new cart by using this code snippet:
var orderRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<EPiServer.Commerce.Order.IOrderRepository>();
|
var cart = orderRepository.LoadCart<ICart>(EPiServer.Security.PrincipalInfo.CurrentPrincipal.GetContactId(), "Default"); |
|
Expected: The new cart is loaded.
Actual: The new cart cannot be loaded. The cart object is null.
Problem is reproducible on Quicksilver (Commerce 10.6.0). After doing an IIS-Reset, try to load cart again and the cart appears.