Parameters
NoneReturns
Promise<ShopifyCart>
Examples
Clear cart
Clear cart button
Clear before adding new items
This method removes all line items but keeps the same cart session. The cart
ID remains unchanged.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Remove all items from the cart
openbridge.cart.clear()
Promise<ShopifyCart>
await openbridge.cart.clear()
console.log(openbridge.cart.count()) // 0
document.querySelector('.clear-cart').addEventListener('click', async () => {
if (confirm('Remove all items from cart?')) {
await openbridge.cart.clear()
}
})
async function startFreshOrder(items) {
await openbridge.cart.clear()
await openbridge.cart.add(items)
}