Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Serializable Carts, cache not refreshed

Found in

EPiServer.Commerce 10.6.0

Fixed in

EPiServer.Commerce 12.0.0

(Or a related package)

Created

May 29, 2017

Updated

Apr 13, 2018

State

Closed, Cannot Reproduce


Description

Issue Description

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.

Steps to Reproduce

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.

Customer Impact Statement

Problem is reproducible on Quicksilver (Commerce 10.6.0). After doing an IIS-Reset, try to load cart again and the cart appears.