Created
April 21, 2014 19:54
-
-
Save jbubriski/11154423 to your computer and use it in GitHub Desktop.
Kentico - Add an item to the shopping cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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