/// <summary> /// Deletes from shopping cart. /// </summary> /// <param name="productCode">The product code.</param> public static void DeleteFromShoppingCart(string productCode) { Assert.ArgumentNotNullOrEmpty(productCode, "productCode"); ShoppingCart shoppingCart = Context.Entity.GetInstance <ShoppingCart>(); ShoppingCartLine existingShoppingCartLine = shoppingCart.ShoppingCartLines.FirstOrDefault(p => p.Product.Code.Equals(productCode)); try { if (existingShoppingCartLine != null) { Tracker.StartTracking(); AnalyticsUtil.ShoppingCartProductRemoved(existingShoppingCartLine.Product.Code, existingShoppingCartLine.Product.Title, existingShoppingCartLine.Quantity); } } catch (Exception ex) { LogException(ex); } IShoppingCartManager shoppingCartManager = Context.Entity.Resolve <IShoppingCartManager>(); shoppingCartManager.RemoveProduct(productCode); }