Skip to main content
POST
/
api
/
v1
/
cart
/
update.json
Update Cart
curl --request POST \
  --url https://api.launchmystore.io/api/v1/cart/update.json \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "updates": {},
  "note": "<string>",
  "attributes": {}
}
'
{
  "success": true,
  "data": {}
}

Documentation Index

Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt

Use this file to discover all available pages before exploring further.

Update Cart

Updates quantities of items in the cart, or updates cart attributes.

Request

curl -X POST "https://api.launchmystore.io/api/v1/cart/update.json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "updates": {
      "var_def456": 3,
      "var_ghi789": 0
    }
  }'

Body Parameters

updates
object
Object mapping variant IDs to new quantities. Set quantity to 0 to remove.
note
string
Update cart note
attributes
object
Update cart attributes (replaces existing attributes)

Alternative: Line Item Based Updates

You can also update using line item IDs:
{
  "line_items": [
    {
      "id": "li_001",
      "quantity": 3
    },
    {
      "id": "li_002",
      "quantity": 0
    }
  ]
}

Response

success
boolean
Whether the request succeeded
data
object
Updated cart object

Example Response

{
  "success": true,
  "data": {
    "token": "cart_xyz789",
    "items": [
      {
        "id": "li_001",
        "product_id": "prod_abc123",
        "variant_id": "var_def456",
        "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,
    "note": "",
    "attributes": {}
  }
}

Updating Cart Note and Attributes

{
  "note": "Please gift wrap this order",
  "attributes": {
    "gift_message": "Happy Birthday!",
    "preferred_delivery_date": "2024-03-25"
  }
}

Error Codes

CodeDescription
UNAUTHORIZEDInvalid or missing access token
NOT_FOUNDCart or line item not found
QUANTITY_UNAVAILABLERequested quantity exceeds available stock
VALIDATION_ERRORInvalid request body