Adding Items to a Cart
If the item being added is already in the cart, you have to use the
CartModify
operation to change the quantity of the items already in the cart. You cannot
use
CartAdd
to add items that are already in a cart. In the following example, the quantity
of the specified item is changed to 10.
http://ecs.amazonaws.com/onca/xml? Service=AWSECommerceService& AWSAccessKeyId=[AWS Access Key ID]
& AssociateTag=[Associate ID]
& Operation=CartModify & CartId=102-5929035-5792105& HMAC=[HMAC]
& Item.1.CartItemId=[Cart Item ID]
& Item.1.Quantity=10
Notice that the item in the cart is referred to by its
CartItemId
. The
Quantity
value, 10, is the total number of those items that should be in the cart.
If the item being added to the cart is not already in the cart, you must use
the
CartAdd
operation.
CartAdd
cannot increase the quantity of items that are already in the cart. If you try
to do that, you get an error.
The following is an example of a request using
CartAdd
.
http://ecs.amazonaws.com/onca/xml? Service=AWSECommerceService& AWSAccessKeyId=[AWS Access Key ID]
& CartId=102-5929035-5792105& HMAC=[HMAC]
=& Operation=CartAdd & Item.1.OfferListingId=1400042127& Item.1.Quantity=2
This request adds to the cart two (Quantity=2) of the same items, which are identified by the OfferListingId (1400042127).
As you can see, the method of identifying the item and its quantity to add to
the cart is the same as it was for
CartCreate.
For more information, see
CartCreate.