Skip to main content
PATCH
/
cart
/
{productId}
Update cart item
curl --request PATCH \
  --url https://store.salesive.com/api/v1/cart/{productId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-shop-id: <api-key>' \
  --data '{
  "quantity": 2
}'
{
  "status": 123,
  "success": true,
  "message": "<string>",
  "data": {
    "_id": "<string>",
    "user": "<string>",
    "shop": "<string>",
    "items": [
      {
        "name": "<string>",
        "image": "<string>",
        "price": 123,
        "quantity": 2,
        "product": {
          "_id": "<string>",
          "id": "<string>",
          "name": "<string>",
          "images": [
            "<string>"
          ],
          "price": 123,
          "promoPrice": 123,
          "sku": "<string>",
          "parentProductId": "<string>",
          "variantAttributes": {}
        },
        "variant": "<string>",
        "sku": "<string>",
        "variantAttributes": {}
      }
    ],
    "totalPrice": 123,
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Update base product quantity

Use this route when the cart line item references the base product.
PATCH /cart/68e5bb463a1fc56a8ac150bf
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json

{
  "quantity": 3
}

Path parameters

ParameterTypeDescription
productIdstringProduct identifier of the cart item.

Headers

HeaderTypeDescription
AuthorizationstringProvide the customer token as Bearer <jwt>.
x-shop-idstringIdentify the shop that owns the cart.
Content-TypestringSet to application/json.

Body parameters

FieldTypeRequiredDescription
quantityintegerYesNew quantity to set (minimum 1).

Successful response

{
    "status": 200,
    "success": true,
    "message": "Cart item updated",
    "data": {
        "_id": "68f98d77c8502e9619569c24",
        "items": [
            {
                "product": {
                    "_id": "68e5c1303a1fc56a8ac151e2",
                    "name": "Head phone",
                    "price": 1
                },
                "quantity": 3
            }
        ],
        "totalPrice": 20003
    }
}

Error response

{
    "status": 404,
    "success": false,
    "message": "Cart item not found",
    "data": {}
}
To update a specific variant line item, visit api-reference/endpoint/cart/update-variant.

Authorizations

Authorization
string
header
required

JWT issued by the Salesive Store API for authenticated shoppers.

x-shop-id
string
header
required

Optional storefront identifier sent as a header to scope responses to a specific shop. Try It requests remember this value once provided.

Headers

x-shop-id
string

Optional identifier that scopes responses to a specific storefront when the referer cannot be inferred.

Path Parameters

productId
string
required

Product identifier for the cart item.

Body

application/json
quantity
integer
required

New quantity for the cart line item.

Required range: x >= 1

Response

Cart item updated successfully.

status
integer
required

HTTP status code returned by the API.

success
boolean
required

Indicates whether the request succeeded.

message
string
required

Human-readable response message.

data
object
required