Skip to main content

POST/shopping_cart/update_quantity

Note: Experimental Release This is an experimental method that is available as a Limited Release(Limited Release) to select developers approved by business units.

This method updates the quantity value of a specific item in the eBay member's cart. You specify the ID of the item in the cart (cartItemId) and the new value for the quantity. If the quantity value is greater than the number of available, the quantity value is changed to the number available and a warning is returned. For example, if there are 15 baseballs available and you set the quantity value to 50, the service automatically changes the value of quantity to 15.

The response returns all the items in the eBay member's cart; items added to the cart while on ebay.com as well as items added to the cart using the Browse API. The quantity and state of an item changes often. If the item becomes "unavailable" such as, the listing has ended or the item is out of stock, the item will be returned in the unavailableCartItems container.

Note: The cartItemId is not the same as the item ID. The cartItemId is the identifier of a specific item in the cart and is generated when the item was added to the cart.

URLs for this method

  • Production URL: https://api.ebay.com/buy/browse/v1/shopping_cart/update_quantity
  • Sandbox URL: https://api.sandbox.ebay.com/buy/browse/v1/shopping_cart/update_quantity

    Note: This method is not available in the eBay API Explorer.

Restrictions

This method can be used only for eBay members. For a list of supported sites and other restrictions, see API Restrictions.

Input

Resource URI (production)

POST https://api.ebay.com/buy/browse/v1/shopping_cart/update_quantity

URI parameters

This method has no URI parameters.

HTTP request headers

All requests made to eBay REST operations require you to provide the Authorization HTTP header for authentication authorization.

In addition, this method requires you to include the Content-Type header and its value should be set to "application/json". See HTTP request headers- opens rest request components page for details.

OAuth scope

This request requires an access token created with the authorization code grant flow, using one or more scopes from the following list (please check your Application Keys page for a list of OAuth scopes available to your application):

https://api.ebay.com/oauth/api_scope/buy.shopping.cart

See OAuth access tokens for more information.

Request payload

Copy complete valid JSON to clipboard

Request fields

Input container/fieldTypeDescription
cartItemIdstring

The identifier of the item in the cart to be updated. This ID is generated when the item was added to the cart.

Occurrence: Required

quantityinteger

The new quantity for the item that is being updated.

Occurrence: Required

Output

HTTP response headers

This call has no response headers.

Response payload

{ /* RemoteShopcartResponse */ }

Response fields

Output container/fieldTypeDescription
cartItemsarray of CartItem

An array of the items in the member's eBay cart.

Occurrence: Always

cartItems.cartItemIdstring

The identifier for the item being added to the cart. This is generated when the item is added to the cart.

Occurrence: Always

cartItems.cartItemSubtotalAmount

This is the subtotal of cost of a specific item in the cart. This does not include taxes, shipping costs, discounts, etc. It is price * quantity.

Occurrence: Conditional

cartItems.cartItemSubtotal.currencyCurrencyCodeEnum

The list of valid currencies. Each ISO 4217 currency code includes the currency name followed by the numeric value.

For example, the Canadian Dollar code (CAD) would take the following form: Canadian Dollar, 124.

Occurrence: Conditional

cartItems.cartItemSubtotal.valuestring

The value of the discounted amount.

Occurrence: Conditional

cartItems.imageImage

The primary image of the item. This is the image that appears on the eBay view item page for this item.

Occurrence: Always

cartItems.image.heightinteger

Reserved for future use.

Occurrence: Conditional

cartItems.image.imageUrlstring

The URL of the image.

Occurrence: Always

cartItems.image.widthinteger

Reserved for future use.

Occurrence: Conditional

cartItems.itemIdstring

The RESTful identifier of the item. This identifier is generated when the item was listed.

RESTful Item ID Format: v1|#|#
For example:
v1|2**********2|0
v1|1**********2|4**********2

Occurrence: Always

cartItems.itemWebUrlstring

The URL of the eBay view item page for the item.

Occurrence: Conditional

cartItems.pricePrice

The cost of the item.

Occurrence: Always

cartItems.price.convertedFromCurrencyCurrencyCodeEnum

The three-letter ISO 4217 code representing the currency of the amount in the convertedFromValue field. This value is the pre-conversion currency.

Occurrence: Conditional

cartItems.price.convertedFromValuestring

The monetary amount before any conversion is performed, in the currency specified by the convertedFromCurrency field. This value is the pre-conversion amount. The value field contains the converted amount of this value, in the currency specified by the currency field.

Occurrence: Conditional

cartItems.price.currencyCurrencyCodeEnum

The three-letter ISO 4217 code representing the currency of the amount in the value field. If currency conversion/localization was performed, this is the post-conversion currency of the amount in the value field.

Default: The currency of the user's country.

Occurrence: Always

cartItems.price.valuestring

The amount of the currency specified in the currency field. The value of currency defaults to the standard currency used by the country of the eBay site offering the item. If currency conversion/localization was performed, this is the post-conversion amount.

Default: The currency of the user's country.

Occurrence: Always

cartItems.quantityinteger

The number of this item the buyer wants to purchase.

Occurrence: Conditional

cartItems.titlestring

The title of the item. This can be written by the seller or come from the eBay product catalog.

Occurrence: Always

cartSubtotalAmount

This is the cost of all the items in the member's eBay cart. This does not include taxes, shipping costs, discounts, etc. It is the sum of each item's price * quantity.

Occurrence: Always

cartSubtotal.currencyCurrencyCodeEnum

The list of valid currencies. Each ISO 4217 currency code includes the currency name followed by the numeric value.

For example, the Canadian Dollar code (CAD) would take the following form: Canadian Dollar, 124.

Occurrence: Conditional

cartSubtotal.valuestring

The value of the discounted amount.

Occurrence: Conditional

cartWebUrlstring

The URL of the member's eBay cart.

Occurrence: Always

unavailableCartItemsarray of CartItem

An array of items in the cart that are unavailable. This can be for a variety of reasons such as, when the listing has ended or the item is out of stock. Because a cart never expires, these items will remain in the cart until they are removed.

Occurrence: Conditional

unavailableCartItems.cartItemIdstring

The identifier for the item being added to the cart. This is generated when the item is added to the cart.

Occurrence: Always

unavailableCartItems.cartItemSubtotalAmount

This is the subtotal of cost of a specific item in the cart. This does not include taxes, shipping costs, discounts, etc. It is price * quantity.

Occurrence: Conditional

unavailableCartItems.cartItemSubtotal.currencyCurrencyCodeEnum

The list of valid currencies. Each ISO 4217 currency code includes the currency name followed by the numeric value.

For example, the Canadian Dollar code (CAD) would take the following form: Canadian Dollar, 124.

Occurrence: Conditional

unavailableCartItems.cartItemSubtotal.valuestring

The value of the discounted amount.

Occurrence: Conditional

unavailableCartItems.imageImage

The primary image of the item. This is the image that appears on the eBay view item page for this item.

Occurrence: Always

unavailableCartItems.image.heightinteger

Reserved for future use.

Occurrence: Conditional

unavailableCartItems.image.imageUrlstring

The URL of the image.

Occurrence: Always

unavailableCartItems.image.widthinteger

Reserved for future use.

Occurrence: Conditional

unavailableCartItems.itemIdstring

The RESTful identifier of the item. This identifier is generated when the item was listed.

RESTful Item ID Format: v1|#|#
For example:
v1|2**********2|0
v1|1**********2|4**********2

Occurrence: Always

unavailableCartItems.itemWebUrlstring

The URL of the eBay view item page for the item.

Occurrence: Conditional

unavailableCartItems.pricePrice

The cost of the item.

Occurrence: Always

unavailableCartItems.price.convertedFromCurrencyCurrencyCodeEnum

The three-letter ISO 4217 code representing the currency of the amount in the convertedFromValue field. This value is the pre-conversion currency.

Occurrence: Conditional

unavailableCartItems.price.convertedFromValuestring

The monetary amount before any conversion is performed, in the currency specified by the convertedFromCurrency field. This value is the pre-conversion amount. The value field contains the converted amount of this value, in the currency specified by the currency field.

Occurrence: Conditional

unavailableCartItems.price.currencyCurrencyCodeEnum

The three-letter ISO 4217 code representing the currency of the amount in the value field. If currency conversion/localization was performed, this is the post-conversion currency of the amount in the value field.

Default: The currency of the user's country.

Occurrence: Always

unavailableCartItems.price.valuestring

The amount of the currency specified in the currency field. The value of currency defaults to the standard currency used by the country of the eBay site offering the item. If currency conversion/localization was performed, this is the post-conversion amount.

Default: The currency of the user's country.

Occurrence: Always

unavailableCartItems.quantityinteger

The number of this item the buyer wants to purchase.

Occurrence: Conditional

unavailableCartItems.titlestring

The title of the item. This can be written by the seller or come from the eBay product catalog.

Occurrence: Always

warningsarray of ErrorDetailV3

An array of warning messages. These type of errors do not prevent the call from executing but should be checked.

Occurrence: Always

warnings.categorystring

This string value indicates the error category. There are three categories of errors: request errors, application errors, and system errors.

Occurrence: Always

warnings.domainstring

The name of the primary system where the error occurred. This is relevant for application errors.

Occurrence: Always

warnings.errorIdinteger

A unique code that identifies the particular error or warning that occurred. Your application can use error codes as identifiers in your customized error-handling algorithms.

Occurrence: Always

warnings.inputRefIdsarray of string

An array of reference IDs that identify the specific request elements most closely associated to the error or warning, if any.

Occurrence: Conditional

warnings.longMessagestring

A detailed description of the condition that caused the error or warning, and information on what to do to correct the problem.

Occurrence: Conditional

warnings.messagestring

A description of the condition that caused the error or warning.

Occurrence: Always

warnings.outputRefIdsarray of string

An array of reference IDs that identify the specific response elements most closely associated to the error or warning, if any.

Occurrence: Conditional

warnings.parametersarray of ErrorParameterV3

An array of warning and error messages that return one or more variables contextual information about the error or warning. This is often the field or value that triggered the error or warning.

Occurrence: Conditional

warnings.parameters.namestring

This is the name of input field that caused an issue with the call request.

Occurrence: Conditional

warnings.parameters.valuestring

This is the actual value that was passed in for the element specified in the name field.

Occurrence: Conditional

warnings.subdomainstring

The name of the subdomain in which the error or warning occurred.

Occurrence: NA

HTTP status codes

This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.

StatusMeaning
200OK
400Bad Request
403Insufficient permissions to fulfill the request
409Conflict
500Internal Server Error

Error codes

For more on errors, plus the codes of other common errors, see Handling errors.

CodeDomainCategoryMeaning
10000API_BROWSEAPPLICATIONThere was a problem with an eBay internal system or process. Contact eBay developer support for assistance.
10001API_BROWSEREQUESTThe X-EBAY-C-MARKETPLACE-ID value is not supported. The supported values are: {supportedValues}.
10002API_BROWSEREQUESTInsufficient permissions to fulfill the request.
10007API_BROWSEREQUESTThe field: {field} is required. Add the field and resubmit the call.
10009API_BROWSEREQUESTThe quantity value is invalid. The quantity must be greater than 0.
10012API_BROWSEREQUESTThe value of 'cartItemId' {cartItemId} is invalid.
10013API_BROWSEBUSINESSThe item is not in your cart.
10025API_BROWSEREQUESTThe header 'X-EBAY-C-MARKETPLACE-ID' is required. The valid Marketplaces are: {supportedValues}.

Warnings

For more on warnings, plus the codes of other common warnings, see Handling errors.

CodeDomainCategoryMeaning
10004API_BROWSEBUSINESSThe item {itemId} is not available for purchase. This can be for several reason such as, the listing has ended or the item is out of stock.
10005API_BROWSEBUSINESSThe item {itemId} is revised.
10006API_BROWSEBUSINESSThe item {itemId} in your cart is not available in the quantity specified. The quantity of this item has been changed to the quantity that is currently available. Please review this change before proceeding to checkout..
10020API_BROWSEBUSINESSThe buyer is blocked from purchasing the item {itemId}.
10024API_BROWSEBUSINESSThe buyer is blocked from purchasing the item {itemId} because the seller does not ship to the buyer's location.

Samples

New to making API calls? Please see Making a Call.

Note: Identifiers, such as order IDs or user IDs, and personal data in these samples might be anonymized or may no longer be active on eBay. If necessary, substitute current, relevant eBay data in your requests.

Sample 1: Update the Quantity of an Item in the Cart

This call updates the quantity of one item in the cart.

Input

The inputs are cartItemId and quantity.

POSThttps://api.ebay.com/buy/browse/v1/shopping_cart/update_quantity

Output

The output is the details of the items in the cart; cartItems containing the item information, and the quantity, price, and subtotal. It also returns the subtotal for all the items in the cart (cartSubtotal) and the URL of the cart (cartWebUrl). You can see that the quantity value is now 6.

In this example, one of the items in the cart is unavailable and it is returned in the unavailableCartItems container. Items can be unavailable for several reasons such as, the listing has ended or the item is out of stock. Because a cart never expires, these items will remain in the cart until they are removed.