Skip to main content
Skip to main content

SessionCartContextState

Properties

regionRegionInfoRequired
The region of the cart.
itemsItem[]Required
The items in the cart.
totalItemsnumberRequired
The total items in the cart.
totalnumberRequired
The total amount of the cart.
setRegion(region: RegionInfo) => voidRequired
A state function used to set the region.
addItem(item: Item) => voidRequired
This function adds an item to the session cart.
removeItem(id: string) => voidRequired
This function removes an item from the session cart.
updateItem(id: string, item: Partial<Item>) => voidRequired
This function updates an item in the session cart.
setItems(items: Item[]) => voidRequired
A state function used to set the items in the cart.
updateItemQuantity(id: string, quantity: number) => voidRequired
This function updates an item's quantity in the cart.
incrementItemQuantity(id: string) => voidRequired
This function increments the item's quantity in the cart.
decrementItemQuantity(id: string) => voidRequired
This function decrements the item's quantity in the cart.
getItem(id: string) => undefined | ItemRequired
This function retrieves an item's details by its ID.
clearItems() => voidRequired
Removes all items in the cart.
Was this section helpful?