Here is an example code of how to empty the shopping cart content:
if (ECommerceContext.CurrentShoppingCart != null)
{
ShoppingCartInfoProvider.DeleteShoppingCartInfo(ECommerceContext.CurrentShoppingCart);
ECommerceContext.CurrentShoppingCart = null;
}
The DeleteShoppingCartInfo method removes all records related to the current shopping cart from the database (COM_ShoppingCart and COM_ShoppingCartSKU tables). By entering the null value to the CurrentShoppingCart (ShoppingCartInfo object) property of the ECommerceContext object, we will ensure that the session and/or cookie information is deleted as well.
-mr-