Remove Item
removeItem
allows you to remove a line item from an order.
Usage
removeItem
takes in the following object.
interface UpdateItemQuantityRequest {
orderItemId: string;
}
orderItemId
is theID
of a line item on the order. The order is found on the cart resource, withline_items
on the order being an array of line items. For example, to pick the first line item’s ID on the order you’d useitem.order.line_items.0.id
.
Example
const removeItemRequest = {
orderItemId: '11ee2722e42886d182fa089e019fd17a',
};
try {
const response = await sdk.cart.removeItem(removeItemRequest);
} catch (error) {
// Handle errors
}
Return Value and Error Handling
removeItem
has the same return value and error handling that is covered in addItem.