UseCart
Extends
Section titled “Extends”Properties
Section titled “Properties”add: (
sku,quantity?) =>Promise<void>
Parameters
Section titled “Parameters”string
quantity?
Section titled “quantity?”number
Returns
Section titled “Returns”Promise<void>
announcement
Section titled “announcement”announcement: {
n:number; } |null
Changes (n goes up) each time something was added, for a polite live region to speak once.
Inherited from
Section titled “Inherited from”cart:
Cart|null
The server’s cart, as of the last answer. Never carries the cart token.
Inherited from
Section titled “Inherited from”clear: () =>
void
Removes the cart and the pending order from this device. Call it from your own “forget this device” button if you do not hand the provider a visitors instance.
Returns
Section titled “Returns”void
closeDrawer
Section titled “closeDrawer”closeDrawer: () =>
void
Returns
Section titled “Returns”void
count:
number
Units in the cart. Moves optimistically with an add and is put back if the server refuses.
Inherited from
Section titled “Inherited from”drawerOpen
Section titled “drawerOpen”drawerOpen:
boolean
Inherited from
Section titled “Inherited from”fault:
CartFault|null
Inherited from
Section titled “Inherited from”hasHeader
Section titled “hasHeader”hasHeader:
boolean
A header cart button is mounted and speaks additions itself.
Inherited from
Section titled “Inherited from”openDrawer
Section titled “openDrawer”openDrawer: () =>
void
Returns
Section titled “Returns”void
paying
Section titled “paying”paying:
boolean
A checkout has started and the shopper is on their way to the payment page. Guards a second submit.
Inherited from
Section titled “Inherited from”pending
Section titled “pending”pending:
boolean
A write is in flight.
Inherited from
Section titled “Inherited from”remove
Section titled “remove”remove: (
sku) =>Promise<void>
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
setQuantity
Section titled “setQuantity”setQuantity: (
sku,quantity) =>Promise<void>
Parameters
Section titled “Parameters”string
quantity
Section titled “quantity”number
Returns
Section titled “Returns”Promise<void>
status
Section titled “status”status:
CartStatus
Inherited from
Section titled “Inherited from”store:
CartStore|null
The store, for the actions the hook does not wrap. null when the cart is off or not ready.
testOrder
Section titled “testOrder”testOrder:
boolean
The checkout that started said it is a test-mode order.