| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Topics
The following sections describe remote shopping carts in detail.
A cart can contain up to 50 entries. Each entry can represent one or more (up to 999) of the same items. That means that a Product Advertising API shopping cart can contain a maximum of almost 50,000 items.
Many products have a limit on the quantity that can be added to a cart. Sometimes
this is inherent to the product, for example, one-of-a-kind jewelry items. Sometimes
it is a limit set by the vendor, for example, they might set a limit on big ticket
items, such as a motorcycle, of one per customer. If you add an item to the cart
with a quantity that exceeds the maximum allowed,
CartAdd
automatically resets the quantity to the maximum value. No error is generated.
Therefore, you must verify the quantity of items in the cart with the number ordered
to determine if the quantity has been capped. If so, you must notify the customer.
Shopping carts have two distinct areas:

Available items placed in a shopping cart are automatically added to the Active area unless the customer specifies otherwise. Unavailable items or items in the shopping cart that become unavailable are automatically put into the SaveForLater area. When those items become available Amazon automatically moves the items to the Active area of the shopping cart.
The SaveForLater area can also be used by customers as a holding place for items they are interested in but not ready to purchase. The prices and availability for items in this area are regularly updated by Amazon.
Product Advertising API operations sometimes return items that cannot be added to the Active cart area. The following sections explain those cases:
Out of stock items
Items with limited quantities
Digital items
Variation parent items
Collection parent items
Most items for sale are available immediately. There are times, however, when that is not true. Items can go out of stock or very popular items, such as a new Harry Potter book, are pre-sold, that is, the book is sold before the book is even published.
When a customer adds an item to their cart that is not available, it is added to the SavedForLater area. Also, if an item in the cart, for some reason, becomes unavailable, Amazon automatically moves the item in the cart to the SavedForLater items section.
It is also possible for a customer to add an item directly to the SavedForLater items area in their cart so that they can easily purchase the item at a later date.
When items become available, you can use the
CartModify
operation with the Action parameter to move items from the SaveForLater section
of the cart to the Active section, which is fully described in
Moving Adding Items as Saved For
Later.
Or, if Amazon automatically moved an item in the Active area to the SaveForLater
area because the item went out of stock, Amazon will move it back into the
Active area automatically when it becomes available.
Many products have a limit on the quantity that can be added to a cart.
Sometimes this is inherent to the product, for example, one-of-a-kind jewelry
items. Sometimes it is a limit set by the vendor, for example, they might set a
limit for big ticket items of one per customer. If you add an item to the cart
with a quantity that exceeds the maximum,
CartAdd
or
CartCreate
automatically resets the quantity to the maximum. No error is generated.
Therefore, you must verify the quantity of items in the cart with the number
ordered to determine if the quantity has been capped. If so, you must notify the
customer.
Digital Items, such as Kindle books and MP3 files, can be purchased only by using Amazon 1-click. They cannot be placed in the cart.
Variation parent items cannot be added to a cart. For example, you cannot add Apparel to a cart because it is not clear what apparel you really want to buy. You could add one of its children, however, such as a red shirt, size large. If you try to add a parent item, you get an error message similar to the following.
The item you specified, [ASIN], is not eligible to be added to the cart. Check the item’s availability to make sure it is available.Variation parents do not have corresponding OfferListingId's.
Collection parent items are abstractions of the items in the collection. The collection parent cannot be added to a cart. The Collection parent is used as a name holder for the collection. Collection parents do not have corresponding OfferListingId's.
ASINs identify items, such as a Harry Potter book. ASINs do not, however, identify sales information related to those items.

As you can see in the preceding figure, an ASIN identifies an item but not an instance of it that a customer can purchase. Every ASIN can be sold by many merchants. Each merchant lists the condition and price of the item. This combination of data represents an OfferListingId. Taken together, all OfferListingIds are referred to as offers. If an ASIN does not have an OfferListingId, the item cannot be purchased.
For this reason, it is recommended that you add items to a shopping cart by their OfferListingId rather than by their ASIN.
Although a Product Advertising API application or web site runs on your servers, Product Advertising API remote shopping carts are hosted by Amazon servers. You use Product Advertising API operations to create and modify the cart and its contents. Keeping a local copy of a shopping cart is not recommended because the price and availability of items change often and Amazon automatically updates items in shopping carts. Also, Amazon automatically updates the status of lists, such as Wishlists, when a customer buys an item on a list. Keeping a local copy of a shopping cart runs the risk of cart items getting out of sync with their real price, availability, and status.
Because Product Advertising API shopping carts are hosted by Amazon instead of a local host, the shopping carts are called "remote." The cart used by a customer shopping on the Amazon retail web site, www.amazon.com in the US locale, is considered the "local" shopping cart. Amazon maintains for each customer ID only one local shopping cart. Developers can maintain more than one remote shopping cart for a customer but maintaining one cart per customer ID is recommended.
Shopping carts have a lifespan. A remote shopping cart is created and, in time, it expires. In between, the contents of the cart can be modified and purchased, as shown in the following diagram.

The first time a customer wants to add an item to their shopping cart, a
remote shopping cart must be created, which is accomplished using the
CartCreate
operation. It is not possible to create an empty cart. At least, one item must
be added.
If a customer has an existing remote shopping cart, it should be used and modified accordingly. Modification can come in many forms:
Items can be added to and deleted from the cart
Items can be moved from the Active area of the cart to the SaveForLater area, or the reverse
The CartId and HMAC are used in the
CartModify,
CartAdd, or
CartClear
operations to modify the contents of the cart.
It is not possible to delete a remote shopping cart. Instead, it
expires automatically after ninety days of disuse if there are items in the
cart, or, if the cart is empty, after seven days of disuse. Carts are emptied
either by the
CartClear
or
CartModify
operations, or automatically when the customer purchases the items in their
cart. The expiration of the cart is reset when the cart is modified. For
example, if, on day eighty-nine of disuse, a customer modifies the items in
their shopping cart, the life time of the cart is reset to an additional ninety
days. In that way, shopping carts can last indefinitely.
Once the items in a cart have been purchased using the
PurchaseURL
value, the cart is not deleted immediately but it should no longer be used.
From a customer's point of view, once he or she has purchased the items in
their cart and there are no items remaining in the SaveForLater section, the old
cart is gone. The next time they want to purchase an item, they receive a new
cart.