Remove Cart Item

You can easily remove items from the Cart. A successful Cart item removal request will return the cart items.

delete
Remove Item from Cart

https://api.moltin.com/v2/carts/:reference/items/:id
Request
Response
Path Parameters
reference
required
string
A unique reference for the cart created by you
id
required
string
The unique identifier for this cart item
Headers
Authorization
required
string
The Bearer token to grant access to the API
200: OK
{
"data": [],
"meta": {
"display_price": {
"with_tax": {
"amount": 0,
"currency": "",
"formatted": "0"
},
"without_tax": {
"amount": 0,
"currency": "",
"formatted": "0"
}
},
"timestamps": {
"created_at": "2018-05-08T10:25:40.02Z",
"updated_at": "2018-05-08T10:25:40.02Z"
}
}
}
cURL
JavaScript SDK
Moltin Request
curl -X DELETE https://api.moltin.com/v2/carts/:reference/items/:id \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const reference = 'XXXX'
const itemId = 'XXXX'
Moltin.Cart(reference)
.RemoveItem(itemId)
.then(cart => {
// Do something
})
const { MoltinClient } = require('@moltin/request')
const client = new MoltinClient({
client_id: 'X'
})
const reference = 'XXXX'
const itemId = 'XXXX'
client
.delete(`carts/${reference}/items/${itemId}`)
.then(items => {
// Do something...
})
.catch(console.error)