> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openbridge.shop/llms.txt
> Use this file to discover all available pages before exploring further.

# .remove()

> Remove items from the cart

```javascript theme={null}
openbridge.cart.remove(lineId)
openbridge.cart.remove(lineIds)
```

Removes one or more items from the cart.

## Parameters

### Single item

| Param    | Type     | Required | Description  |
| -------- | -------- | -------- | ------------ |
| `lineId` | `string` | Yes      | Cart line ID |

### Multiple items

| Param     | Type       | Required | Description       |
| --------- | ---------- | -------- | ----------------- |
| `lineIds` | `string[]` | Yes      | Array of line IDs |

## Returns

`Promise<`[`ShopifyCart`](/api/types/cart#shopifycart)`>`

## Examples

### Remove single item

```javascript theme={null}
const lines = openbridge.cart.lines()
await openbridge.cart.remove(lines[0].id)
```

### Remove multiple items

```javascript theme={null}
const lines = openbridge.cart.lines()
const idsToRemove = lines.slice(0, 2).map((l) => l.id)

await openbridge.cart.remove(idsToRemove)
```

### Remove button

```javascript theme={null}
document.querySelectorAll('.remove-item').forEach((button) => {
    button.addEventListener('click', async () => {
        const lineId = button.dataset.lineId
        await openbridge.cart.remove(lineId)
    })
})
```

### Remove all of a specific product

```javascript theme={null}
const productHandle = 'awesome-tshirt'
const lines = openbridge.cart.lines()

const linesToRemove = lines
    .filter((line) => line.merchandise.product.handle === productHandle)
    .map((line) => line.id)

if (linesToRemove.length > 0) {
    await openbridge.cart.remove(linesToRemove)
}
```

<Tip>
  To remove all items at once, use [`.clear()`](/api/cart/clear) instead.
</Tip>
