Click or drag to resize
IShoppingServiceAddItemToCart Method (Int32, Int32)
Adds an item to the current shopping cart and logs the activity. Saves the shopping cart if it has not been saved yet. If an item in such configuration is already present in the cart, its quantity is increased by quantity. Saves all product options and bundle items after adding and evaluates the cart.

Namespace: CMS.Ecommerce
Assembly: CMS.Ecommerce (in CMS.Ecommerce.dll) Version: 12.0.0
Syntax
C#
ShoppingCartItemInfo AddItemToCart(
	int skuId,
	int quantity
)

Parameters

skuId
Type: SystemInt32
Id of SKU item to be added.
quantity
Type: SystemInt32
Quantity of the item to be added.

Return Value

Type: ShoppingCartItemInfo
Returns the resulting item added/updated.
Exceptions
ExceptionCondition
InvalidOperationExceptionThrown when skuId specifies a product from a different site than current shopping cart belongs to.
Remarks

The method does nothing when quantity is less than 1 and returns null.

This override is effectively the same as encapsulating given arguments in a new ShoppingCartItemParameters object and calling AddItemToCart(ShoppingCartItemParameters).

See Also