use-shopping-cart

clearCart()

clearCart()

clearCart() totally empties out the shopping cart. You might want to run this on your successUrl page to clear the products out of local storage.

{}
import { useShoppingCart } from 'use-shopping-cart'
function Component() {
const { clearCart } = useShoppingCart()
return <button onClick={clearCart}>Remove all items</button>
}
Edit this page on GitHub