Click or drag to resize
IShoppingServiceAddItemToCart Method (ShoppingCartItemParameters)
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(
	ShoppingCartItemParameters itemParameters
)

Parameters

itemParameters
Type: CMS.EcommerceShoppingCartItemParameters
Parameters specifying the item to be added.

Return Value

Type: ShoppingCartItemInfo
Returns the resulting item added/updated.
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown when itemParameters is null.
InvalidOperationExceptionThrown when itemParameters specify a product's SKUID from a different site than current shopping cart belongs to.
Remarks
The method does nothing when Quantity is less than 1 and returns null.
See Also