Newer Version Available

This content describes an older version of this product. View Latest

Commerce Webstore Cart Item

Update or delete an item in a cart.

Buyers with read access to carts can add, update, and delete items in carts.

Updating items in a cart respects buyer View Product entitlements and only users entitled to view product data can access it.

Resource
1/commerce/webstores/webstoreId/carts/cartStateOrId/cart-items/cartItemId
Values for cartStateOrId are:
  • cartId—ID of the cart.
  • active—Active cart.
  • current—Cart that isn’t closed or pending deletion. Available in version 50.0 and later.
Available version
49.0
Requires Chatter
No
HTTP methods
DELETE, PATCH
Request parameters for DELETE
Parameter Name Type Description Required or Optional Available Version
effective​AccountId String ID of the buyer account or guest buyer profile for which the request is made. If unspecified, the default value is determined from context. Optional 49.0
Response for DELETE
204: Successful Delete
Request body for PATCH
Root XML tag
<cartItem>
JSON example for adding an item to a cart
1{
2   "productId":"01t000000000000000",
3   "quantity":"5",
4   "type":"Product"
5}
JSON example for updating an item in a cart
1{
2   "quantity":"7"
3}
Properties
Name Type Description Required or Optional Available Version
productId String ID of the product. Required when adding an item to a cart (POST)

Not supported when updating an item in a cart (PATCH)

49.0
quantity String Quantity of the cart item. Use a value that can be converted to BigDecimal. Required 49.0
type String Type of item in a cart. Value is Product. Required when adding an item to a cart (POST)

Not supported when updating an item in a cart (PATCH)

49.0
Request parameters for PATCH
Parameter Name Type Description Required or Optional Available Version
currencyIsoCode String Currency ISO code of the cart. Optional 57.0
effective​AccountId String ID of the buyer account or guest buyer profile for which the request is made. If unspecified, the default value is determined from context. Optional 49.0
Response body for PATCH
Cart Item