Update Cart
curl --request POST \
--url https://your-store.launchmystore.io/cart/update.js \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"updates": [
{}
],
"note": "<string>",
"attributes": {},
"discount": "<string>"
}
'import requests
url = "https://your-store.launchmystore.io/cart/update.js"
payload = {
"updates": [{}],
"note": "<string>",
"attributes": {},
"discount": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({updates: [{}], note: '<string>', attributes: {}, discount: '<string>'})
};
fetch('https://your-store.launchmystore.io/cart/update.js', 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://your-store.launchmystore.io/cart/update.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'updates' => [
[
]
],
'note' => '<string>',
'attributes' => [
],
'discount' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://your-store.launchmystore.io/cart/update.js"
payload := strings.NewReader("{\n \"updates\": [\n {}\n ],\n \"note\": \"<string>\",\n \"attributes\": {},\n \"discount\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://your-store.launchmystore.io/cart/update.js")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"updates\": [\n {}\n ],\n \"note\": \"<string>\",\n \"attributes\": {},\n \"discount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-store.launchmystore.io/cart/update.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"updates\": [\n {}\n ],\n \"note\": \"<string>\",\n \"attributes\": {},\n \"discount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCart
Update Cart
Update cart items or attributes
POST
/
cart
/
update.js
Update Cart
curl --request POST \
--url https://your-store.launchmystore.io/cart/update.js \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"updates": [
{}
],
"note": "<string>",
"attributes": {},
"discount": "<string>"
}
'import requests
url = "https://your-store.launchmystore.io/cart/update.js"
payload = {
"updates": [{}],
"note": "<string>",
"attributes": {},
"discount": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({updates: [{}], note: '<string>', attributes: {}, discount: '<string>'})
};
fetch('https://your-store.launchmystore.io/cart/update.js', 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://your-store.launchmystore.io/cart/update.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'updates' => [
[
]
],
'note' => '<string>',
'attributes' => [
],
'discount' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://your-store.launchmystore.io/cart/update.js"
payload := strings.NewReader("{\n \"updates\": [\n {}\n ],\n \"note\": \"<string>\",\n \"attributes\": {},\n \"discount\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://your-store.launchmystore.io/cart/update.js")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"updates\": [\n {}\n ],\n \"note\": \"<string>\",\n \"attributes\": {},\n \"discount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-store.launchmystore.io/cart/update.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"updates\": [\n {}\n ],\n \"note\": \"<string>\",\n \"attributes\": {},\n \"discount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyUpdate Cart
Updates quantities of items in the cart, or updates the cart note, attributes, and discount codes.Cart update is a storefront surface, not part of the OAuth
/api/v1 app
API. It follows the AJAX cart contract: requests are made against the
storefront origin (your store domain), identity is the cart cookie token
(not a Bearer access token), and the response is the flat cart
object — not wrapped in a { status, type, data } envelope.Request
curl -X POST "https://your-store.launchmystore.io/cart/update.js" \
-H "Content-Type: application/json" \
-H "Cookie: cart=c1-xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" \
-d '{
"updates": {
"639664": 3,
"640001": 0
}
}'
const response = await fetch('/cart/update.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
updates: {
"639664": 3,
"640001": 0 // Remove item
}
})
});
const cart = await response.json();
Body Parameters
Either an object mapping variant ids or line item keys to new
quantities (a variant id not yet in the cart is added), or an array of
quantities by line position (
[1, 0, 3] sets line 1 to 1, removes line 2,
sets line 3 to 3). Quantities must be whole numbers >= 0; 0 removes the
line. Every quantity is checked first — a negative or fractional one
returns 422 and nothing changes.Cart attributes to set. Merged into the existing attributes (as on
Shopify); set a key to
"" or null to remove it.Discount code(s) to apply. Accepts a single code or comma-separated codes.
Pass an empty string to clear all applied discount codes.
Response
The response is the flat cart object (the same shape returned by Get Cart), reflecting the updated cart. For quantity updates the response also includes anitems_changelog object
({ added, removed }).
Example Response
{
"token": "c1-9a3f0c2e-7b1d-4e8a-9f2c-1a2b3c4d5e6f",
"items": [
{
"key": "639664:",
"id": 639664,
"product_id": 12001,
"variant_id": 639664,
"title": "Classic T-Shirt",
"variant_title": "Medium / Black",
"quantity": 3,
"price": 2500,
"line_price": 7500,
"sku": "TSHIRT-M-BLK"
}
],
"item_count": 3,
"total_price": 7500,
"currency": "USD",
"note": "",
"attributes": {},
"items_changelog": {
"added": [{ "id": 639664, "quantity": 3 }],
"removed": [{ "id": 640001 }]
}
}
Updating Cart Note, Attributes, and Discounts
{
"note": "Please gift wrap this order",
"attributes": {
"gift_message": "Happy Birthday!",
"preferred_delivery_date": "2024-03-25"
},
"discount": "SUMMER10"
}
Errors
On failure the endpoint returns a standard error body with the real HTTP status:{
"status": 422,
"message": "Requested quantity exceeds available stock",
"description": "Requested quantity exceeds available stock"
}