Carts

Partial update a cart

patch/carts/{id}

Request

  • Base URL
    https://dummyjson.com
  • URL
    https://dummyjson.com/carts/{id}
  • Auth
    none required

Path parameters

idinteger required

Resource id.

Query parameters

delayinteger

Artificial response delay in milliseconds (0–5000).

Request body

userIdinteger
mergeboolean

PUT/PATCH only: keep the existing cart products and add the new ones.

Example request

{
  "userId": 1,
  "products": [
    {
      "id": 144,
      "quantity": 4
    }
  ]
}

Response

Updated cart

idinteger
totalnumber
discountedTotalnumber
userIdinteger
totalProductsinteger
totalQuantityinteger

Example response

{
  "id": 1,
  "products": [
    {
      "id": 162,
      "title": "Blue Frock",
      "price": 29.99,
      "quantity": 4,
      "total": 119.96,
      "discountPercentage": 12.13,
      "discountedTotal": 105.41,
      "thumbnail": "https://cdn.dummyjson.com/product-images/tops/blue-frock/thumbnail.webp"
    }
  ],
  "total": 13037.88,
  "discountedTotal": 11510.81,
  "userId": 1,
  "totalProducts": 4,
  "totalQuantity": 12
}

Changes

No recorded changes to this operation across all 1 revision of this API.