Custom Shopping Cart - Order Completed, How do I create a new empty Shopping Cart and set it as the

Jeffrey Schulz asked on August 18, 2016 04:14

I have my code to set my order is complete and I have made made my existing cart complete.

cartInfo.MakeComplete(true);
cartInfo.Update();

When an order/cart is complete, how do I create a new empty shopping cart and set it to the current shopping cart?

I tried

ShoppingCartInfo newCart = ShoppingCartInfo.CreateShoppingCartInfo(SiteContext.CurrentSiteID);
ShoppingCartInfoProvider.SetShoppingCartInfo(newCart);
ECommerceContext.CurrentShoppingCart = newCart;

but I always get the previous cart, not the new one when I load ECommerceContext.CurrentShoppingCart;

Recent Answers


Richard Sustek answered on August 18, 2016 08:00 (last edited on August 18, 2016 08:00)

Try using following methods from ShoppingCartInfoProvider class:

ShoppingCartInfoProvider.ClearShoppingCartPrivateData(ECommerceContext.CurrentShoppingCart); 
// clears properties such as addresses, shipping option, discount coupons...

ShoppingCartInfoProvider.EmptyShoppingCart(ECommerceContext.CurrentShoppingCart); 
// clears all items in shopping cart
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.