Skip to main content
PATCH
/
cart
/
{productId}
/
{variantId}
Update cart variant
curl --request PATCH \
  --url https://store.salesive.com/api/v1/cart/{productId}/{variantId} \
  --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>",
    "items": [
      {
        "name": "<string>",
        "image": "<string>",
        "price": 123,
        "quantity": 2,
        "_id": "<string>",
        "product": {
          "_id": "<string>",
          "id": "<string>",
          "name": "<string>",
          "images": [
            "<string>"
          ],
          "price": 123,
          "promoPrice": 123,
          "sku": "<string>",
          "parentProductId": "<string>",
          "variantAttributes": {}
        },
        "food": {
          "_id": "<string>",
          "id": "<string>",
          "name": "<string>",
          "images": [
            "<string>"
          ],
          "price": 123,
          "promoPrice": 123
        },
        "foodId": "<string>",
        "variant": "<string>",
        "sku": "<string>",
        "variantAttributes": {},
        "selectedAddons": [
          {
            "addonId": "<string>",
            "name": "<string>",
            "price": 123,
            "quantity": 2,
            "description": "<string>"
          }
        ]
      }
    ],
    "totalPrice": 123,
    "user": "<string>",
    "shop": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Request

PATCH /cart/692cd420b07303c9be5eafd7/692cd420b07303c9be5eafda
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json

{
  "quantity": 3
}

Path parameters

ParameterTypeDescription
productIdstringProduct identifier that owns the variant line item.
variantIdstringVariant identifier to update within the product.

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": "693606ada7a8f7dc8ae32d80",
        "items": [
            {
                "itemType": "product",
                "product": null,
                "variant": "692cd420b07303c9be5eafda",
                "name": "Wireless Headphones Pro",
                "image": "https://cdn.salesive.com/products/headphones.jpg",
                "price": 25000,
                "sku": "WHP-PRO-BLACK",
                "variantAttributes": {
                    "color": "black"
                },
                "quantity": 3,
                "_id": "6937b6e9e455c711f1fc9064",
                "selectedAddons": [],
                "id": "6937b6e9e455c711f1fc9064"
            }
        ],
        "totalPrice": 75000,
        "id": "693606ada7a8f7dc8ae32d80"
    }
}

Error response

{
    "status": 404,
    "success": false,
    "message": "Cart item not found",
    "data": {}
}

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.

variantId
string
required

Variant identifier for the cart item.

Body

application/json
quantity
integer
required

New quantity for the cart line item.

Required range: x >= 1

Response

Cart variant 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