November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Where are you calling this method. Calling DeleteCart should delete the cart and invalidate the cache with out any additional steps needed.
Thanks for your reply Mark!
Using the Quicksilver, it is called in the CheckoutController and method Finish. Just before the confirmation email is sent.
I think it has worked before but it suddenly stopped working. What could cause the cache to not invalidate?
The cart is delete from the Commerce Manager, so that is working.
public void DeleteCart() { var cart = CartHelper.Cart; CartHelper.Delete(); cart.AcceptChanges(); }
Can you try changing to this I dont think the other calls are needed and there was a recent bug fix when deleting addresss it might be trying to delete the shipment that was just deleted before.
I actually found me doing this:
CartHelper.Cart.CustomerId = customerId; CartHelper.Cart.CustomerName = customerName;
And after looking into the CartHelper code it looks lite the CustomerId is used for caching. I guess manipulating the CustomerId could be the problem.
So that was the problem!
During checkout I create a new contact and customer if it is an anonymous user and I want that customer connected to the cart. To do this I add the newly created customer to the cart by using:
CartHelper.Cart.CustomerId = customerId;
It works just fine and the purchase order is created with the new customer connected. BUT, since I changed the CustomerId the cart cache is not invalid because the CustomerId is used in the cache key.
The work around is to create the purchase order first and then connect new customer to the purchase order instead of the cart.
purchaseOrder.CustomerId = Guid.Parse(customerContact.PrimaryKeyId.ToString()); purchaseOrder.CustomerName = organization.Name;
/Kristoffer
Hi!
We are using Quicksilver and are having some problems with our cart.
After a purchase we use the _checkoutService.DeleteCart() but what happens is that the Cart.ObjectState set to Deleted, the cart doesn't seem to be removed. So when the user tries to add a new item to the cart a DeletedObjectInaccessibleException is thrown. How can I do to be sure that the cart is deleted and new one initiated?
Thanks!
/Kristoffer