How to empty the shopping cart content outside the shopping cart control?

Miro Remias asked on February 20, 2012 21:53

How to empty the shopping cart content outside the shopping cart control?

Correct Answer

Miro Remias answered on February 20, 2012 21:53

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-
0 votesVote for this answer Unmark Correct answer

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