Skip to content

Instantly share code, notes, and snippets.

@pavsaund
Created October 19, 2016 11:39
Show Gist options
  • Save pavsaund/d5c46d7464f856be7da867baff3d0570 to your computer and use it in GitHub Desktop.
Save pavsaund/d5c46d7464f856be7da867baff3d0570 to your computer and use it in GitHub Desktop.
public class ShoppingCartWithCustomerTraceLogging : ShoppingCart
{
/// <summary>
/// Preferred way to add item to a customers shopping cart
/// Will add the needed extra logging required.
/// </summary>
/// <param name="item"> A CartItem that contains the qty, sku, and item price and item total price</param>
public override void AddCartItem(CartItem item)
{
base.AddCartItem(item);
Track(CustomerAction.CartItemAddedToCart);
}
void Track(Action action)
{
CustomerTrackingService.SignalTotalInShoppingCartUpdated(action, CartTotal);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment