Click or drag to resize
ShoppingServiceAddItemToCart 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: 13.0.131
Syntax
C#
public virtual 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.

Implements

IShoppingServiceAddItemToCart(Int32, Int32)
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