The CartModify operation allows you to modify the quantity of items in a remote shopping cart, as well as move items from the active area of a cart to the save for later area.
Note:
The cart lifespan is currently 90 days from its last access date.
To remove an item from a shopping cart using CartModify, you must set its Quantity to 0.
CartModify is available in all of the locales.
Using CartModify (REST)
This example demonstrates how to use CartModify to increase the quantity of an item (Item.1), remove an item (Item.2), and save an item for later (Item.3) all in the same request.
http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=[Your Access Key ID Here]&AssociateTag=[Your Associate ID Here]&Operation=CartModify&CartId=[A Cart ID]&HMAC=[An HMAC Shopping Cart Token]&Item.1.CartItemId=[A CartItemId]&Item.1.Quantity=5&Item.2.CartItemId=[A CartItemId]&Item.2.Quantity=0&Item.3.CartItemId=[A CartItemId]&Item.3.Action=SaveForLater
Request parameters specify the terms of your request and control the output data that is returned to you.
You must include the required parameters in every request.
CartModify accepts the optional parameters that are common to all operations:
The following parameters are specific to the CartModify operation:
| Parameter | Description | Required? | Value |
|---|---|---|---|
| Operation | The operation. | Always Required | CartModify |
| CartId |
The CartId is a unique identifier for an Amazon remote shopping cart. CartIds are initially obtained by using the CartCreate operation. |
Always Required |
Required Value:
|
| HMAC |
The HMAC is a unique security token that, when used with the CartId, allows you to access and modify (add to, remove from, empty) a specific remote shopping cart that you have created from your application or Web site. HMACs are initially obtained by using the CartCreate operation. Any plus signs ("+") embedded in the HMAC must be encoded as %2B for REST. |
Always Required |
Required Value:
|
| Items |
The Items parameter must be used in all SOAP requests. It cannot be used with any other protocol. The Items parameter serves as a container element for the list of products that will be added to a shopping cart. An Items element would contain 1 or more Item elements in a SOAP request. |
Required for SOAP | |
| Item |
In SOAP Requests: The Item parameter serves as a container element that is a child of the Items element. As a container element, an Item holds product ID elements (like ASIN) and Quantity elements. In REST Requests: The Item parameter in a REST request serves as a means of prefixing one or more products (Item.1.ASIN) and the quantities of those products (Item.1.Quantity). |
Always Required | |
| CartItemId |
The CartItemId parameter is a child element of the Item parameter in both SOAP and REST requests. It is used to uniquely identify each item in a shopping cart. Note that CartItemId is NOT an ASIN or other standard identifier; it is returned by CartCreate and CartAdd only. |
Always Required |
Required Value:
|
| Quantity |
Use the Quantity parameter to change the amount of an item you have in the shopping cart. Quantity must be paired with a CartItemId parameter. It must be used as a child of an Item element in a request. Note: Quantity must be set to 0 to remove an item from a shopping cart. |
Valid Values:
|
|
| Action |
The Action parameter is a child element of the Item parameter in both SOAP and REST requests. Use the Action parameter to change cart items to saved items (SaveForLater) or change saved items to cart items (MoveToCart). |
Valid Values:
|
|
| MergeCart |
Determines whether the remote cart items are merged with the customer's Amazon cart, or if the item can be immediately purchased. The default value is False, which only works with the US locale. You must set MergeCart to True for non-US locales. See Purchasing the Contents of the Cart for more information. |
Optional |
Valid Values:
|
| ListItemId |
The ListItemId parameter is returned by the ListItems Response Group. The parameter identifies an item on a list, such as a wishlist. To add this item to a cart, you must include in the CartCreate request the item's ASIN and ListItemId. The ListItemId attaches name and address of the list owner, which the ASIN alone does not. |
Optional |
Valid Values:
|
| ResponseGroup |
Controls the data returned by the operation. Use this parameter to specify which response group(s), or group(s) of data elements, you would like Amazon E-Commerce Service (ECS) to return to you. You can specify as many response groups as you wish using a comma-separated list (REST) or multiple elements (SOAP). |
Always Optional |
Default Values: Valid Values: |