> ## 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.

# .clear()

> Remove all items from the cart

```javascript theme={null}
openbridge.cart.clear()
```

Removes all items from the cart, leaving it empty.

## Parameters

None

## Returns

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

## Examples

### Clear cart

```javascript theme={null}
await openbridge.cart.clear()

console.log(openbridge.cart.count()) // 0
```

### Clear cart button

```javascript theme={null}
document.querySelector('.clear-cart').addEventListener('click', async () => {
    if (confirm('Remove all items from cart?')) {
        await openbridge.cart.clear()
    }
})
```

### Clear before adding new items

```javascript theme={null}
async function startFreshOrder(items) {
    await openbridge.cart.clear()
    await openbridge.cart.add(items)
}
```

<Note>
  This method removes all line items but keeps the same cart session. The cart
  ID remains unchanged.
</Note>
