Menu
Product Advertising API
Developer Guide (API Version 2013-08-01)

Adding Items to a Cart

Often a customer, after creating a shopping cart, wants to keep shopping and add additional items to an existing shopping cart. You can facilitate this activity using the Product Advertising API operations CartAdd and CartModify.

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.

Copy
http://webservices.amazon.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 &Timestamp=[YYYY-MM-DDThh:mm:ssZ] &Signature=[Request Signature]

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.

Copy
http://webservices.amazon.com/onca/xml? Service=AWSECommerceService& AWSAccessKeyId=[AWS Access Key ID]& AssociateTag=[Associate Tag]& CartId=102-5929035-5792105& HMAC=[HMAC]=& Operation=CartAdd & Item.1.OfferListingId=1400042127& Item.1.Quantity=2 &Timestamp=[YYYY-MM-DDThh:mm:ssZ] &Signature=[Request Signature]

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.