Skip to content
Docs
Reference

Function: deriveCartTotals()

Function: deriveCartTotals() in @ticketlayer/live.

@ticketlayer/live


@ticketlayer/live / index / deriveCartTotals

function deriveCartTotals(cart: unknown): CartTotals;

Defined in: core/cartTotals.ts:103

Read subtotal, fees, discount and total off a cart-shaped response.

Field names are backstage-api's, because live-api never reshapes a body: itemsSubtotal is what the cart view calls its ticket subtotal today, and totalFees / totalDiscounts / total are what the order view calls the rest - the names a cart view would reuse when it starts carrying them. fees, discount and subtotal are accepted as aliases so a host that already massaged the shape keeps working.

Parameters#

ParameterType
cartunknown

Returns#

CartTotals