Skip to content

Instantly share code, notes, and snippets.

@jbubriski
Created April 21, 2014 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbubriski/11154423 to your computer and use it in GitHub Desktop.
Save jbubriski/11154423 to your computer and use it in GitHub Desktop.
Kentico - Add an item to the shopping cart
public void AddItemToShoppingCart(int skuId, int quantity)
{
var skuInfo = SKUInfoProvider.GetSKUInfo(skuId);
// Create params
var cartItemParams = new ShoppingCartItemParameters(skuId, quantity);
// Ensure minimum allowed number of items is met
if (skuInfo.SKUMinItemsInOrder > quantity)
{
cartItemParams.Quantity = skuInfo.SKUMinItemsInOrder;
}
shoppingCartInfo.SetShoppingCartItem(cartItemParams);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment