Skip to main content

Cart Usage

Setup

The useCart hook provides the cart state and all mutation methods:

Adding Items

If no cart exists, calling addLines creates one automatically and persists the cart ID.

Updating Quantities

Removing Lines

Clearing the Cart

Customer Identity

Associate the cart with a logged-in customer:
This is required for the checkout to recognize the customer and apply their saved addresses and payment methods.

Service API

For imperative use outside React components: