Cart properties overview
Reference table for the derived properties returned by use-shopping-cart.
All of these values are exposed by useShoppingCart() so you can render totals,
badges, or debug panels without reaching into internal state. The linked pages
go deeper on each property.
| Property | Type | Purpose |
|---|---|---|
cartCount | number | Total quantity across every cart entry. |
cartDetails | Record<string, CartEntry> | Canonical cart entry map keyed by product id. |
formattedTotalPrice | string | Localized currency string you can drop straight into UI. |
lastClicked | string | The ID saved by storeLastClicked(), or ''. |
shouldDisplayCart | boolean | Whether your cart UI should be open; set by the cart display helpers. |
totalPrice | number | Raw integer total (in the smallest currency unit) for calculations. |
ℹ️ Looking for optimistic state or helper functions? See the
useOptimisticCarthook and theactionssection for mutation helpers.
