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": 1
}'import requests
url = "https://store.salesive.com/api/v1/cart/{productId}/{variantId}"
payload = { "quantity": 1 }
headers = {
"Authorization": "Bearer <token>",
"x-shop-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Bearer <token>',
'x-shop-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({quantity: 1})
};
fetch('https://store.salesive.com/api/v1/cart/{productId}/{variantId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/cart/{productId}/{variantId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'quantity' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/cart/{productId}/{variantId}"
payload := strings.NewReader("{\n \"quantity\": 1\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-shop-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://store.salesive.com/api/v1/cart/{productId}/{variantId}")
.header("Authorization", "Bearer <token>")
.header("x-shop-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/cart/{productId}/{variantId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-shop-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 1\n}"
response = http.request(request)
puts response.read_body{
"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"
}
}Update cart variant
Adjust the quantity for a specific variant line item already in the cart.
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": 1
}'import requests
url = "https://store.salesive.com/api/v1/cart/{productId}/{variantId}"
payload = { "quantity": 1 }
headers = {
"Authorization": "Bearer <token>",
"x-shop-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Bearer <token>',
'x-shop-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({quantity: 1})
};
fetch('https://store.salesive.com/api/v1/cart/{productId}/{variantId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/cart/{productId}/{variantId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'quantity' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/cart/{productId}/{variantId}"
payload := strings.NewReader("{\n \"quantity\": 1\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-shop-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://store.salesive.com/api/v1/cart/{productId}/{variantId}")
.header("Authorization", "Bearer <token>")
.header("x-shop-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/cart/{productId}/{variantId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-shop-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 1\n}"
response = http.request(request)
puts response.read_body{
"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
| Parameter | Type | Description |
|---|---|---|
productId | string | Product identifier that owns the variant line item. |
variantId | string | Variant identifier to update within the product. |
Headers
| Header | Type | Description |
|---|---|---|
Authorization | string | Provide the customer token as Bearer <jwt>. |
x-shop-id | string | Identify the shop that owns the cart. |
Content-Type | string | Set to application/json. |
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
quantity | integer | Yes | New 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
JWT issued by the Salesive Store API for authenticated shoppers.
Optional storefront identifier sent as a header to scope responses to a specific shop. Try It requests remember this value once provided.
Headers
Optional identifier that scopes responses to a specific storefront when the referer cannot be inferred.
Path Parameters
Identifier of the cart line to target. Accepts the cart line's own _id, or the product, food, or service id it holds. A catalog id (product/food/service) matches every line for that item — for a food or service added with different add-on combinations, target one specific line by its _id via /cart/item/{itemId}.
Variant identifier for the cart item.
Body
New quantity for the cart line item. Set to 0 to remove the line.
x >= 0Was this page helpful?

