How to Empty the Shopping Cart Content outside the Shopping Cart Control in Kentico
Following Code is the example code to Empty the Shopping Cart Content in Kentico
**********************************************************************
if (ECommerceContext.CurrentShoppingCart != null)
{
ShoppingCartInfoProvider.DeleteShoppingCartInfo(ECommerceContext.CurrentShoppingCart);
ECommerceContext.CurrentShoppingCart = null;
}
***********************************************************************
Use DeleteShoppingCartInfomethod to remove all the records related to the current shopping cart from the database(_ShoppingCart and COM_ShoppingCartSKU tables)
To Delete the Session or Cookie Information enter the null value to the CurrentShoppingCart (ShoppingCartInfo object) property of the ECommerceContext object.
**********************************************************************
if (ECommerceContext.CurrentShoppingCart != null)
{
ShoppingCartInfoProvider.DeleteShoppingCartInfo(ECommerceContext.CurrentShoppingCart);
ECommerceContext.CurrentShoppingCart = null;
}
***********************************************************************
Use DeleteShoppingCartInfomethod to remove all the records related to the current shopping cart from the database(_ShoppingCart and COM_ShoppingCartSKU tables)
To Delete the Session or Cookie Information enter the null value to the CurrentShoppingCart (ShoppingCartInfo object) property of the ECommerceContext object.