Clear Cart
curl --request POST \
--url https://{shop-domain}/cart/clear.js \
--header 'Authorization: Bearer <token>'import requests
url = "https://{shop-domain}/cart/clear.js"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{shop-domain}/cart/clear.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://{shop-domain}/cart/clear.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{shop-domain}/cart/clear.js"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{shop-domain}/cart/clear.js")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{shop-domain}/cart/clear.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"token": "<string>",
"items": [
{}
],
"item_count": 123,
"total_price": 123,
"currency": "<string>"
}Cart
Clear Cart
Remove all items from the cart
POST
/
cart
/
clear.js
Clear Cart
curl --request POST \
--url https://{shop-domain}/cart/clear.js \
--header 'Authorization: Bearer <token>'import requests
url = "https://{shop-domain}/cart/clear.js"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{shop-domain}/cart/clear.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://{shop-domain}/cart/clear.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{shop-domain}/cart/clear.js"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{shop-domain}/cart/clear.js")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{shop-domain}/cart/clear.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"token": "<string>",
"items": [
{}
],
"item_count": 123,
"total_price": 123,
"currency": "<string>"
}Clear Cart
Removes all line items from the cart. The cart itself (and its token) is preserved, so the same token keeps working for subsequentadd requests.
The cart is a storefront, cookie-based resource, not part of the OAuth
/api/v1 app API. Requests go to the shop’s own domain (e.g.
https://mystore.launchmystore.io/cart/clear.js) and the cart is identified by
the cart cookie that the storefront sets — there is no Authorization: Bearer
header. This mirrors the standard /cart/clear.js AJAX endpoint.Request
curl -X POST "https://mystore.launchmystore.io/cart/clear.js" \
-H "Content-Type: application/json" \
--cookie "cart=c1-YOUR_CART_TOKEN"
const response = await fetch('/cart/clear.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});
const cart = await response.json();
Body Parameters
No parameters required. The request body is ignored —clearCart only ever
deletes the cart’s line items.
Response
Returns the (now empty) cart as a bare cart object — not an{ status, data } envelope.
string
The cart token (unchanged)
array
Line items — empty after a clear
integer
Number of items in the cart (0 after a clear)
integer
Cart total in the currency’s smallest unit (cents)
string
Presentment currency code
Example Response
{
"token": "c1-1a2b3c4d5e6f7890",
"items": [],
"item_count": 0,
"total_price": 0,
"items_subtotal_price": 0,
"total_weight": 0,
"currency": "USD",
"requires_shipping": false,
"note": "",
"attributes": {}
}
Errors
A failed clear returns the same bare response body with an HTTP error status and amessage/description:
{
"status": 422,
"message": "Cart not found",
"description": "Cart not found"
}