Tally UI

CartTotal

CartTotal shows subtotal, optional discount, fees and shipping, tax rows and an optional Total row in the receipt's order.

Import

import { CartTotal } from '@tallyui/components';

Usage

<CartTotal subtotal={subtotal} discount={discount} taxLines={taxLines} total={total} />

Renders rows for subtotal, optional discount, fees and shipping, tax rows and total, in the receipt's order.

Props

PropTypeDefaultDescription
subtotalMoneyrequiredThe subtotal to display
taxLinesArray<{ label: string; amount: Money }>—Tax rows with their labels and amounts
discountMoney—Optional discount, shown when positive
feesMoney—The fee lines' sum in the display mode; a Fees row shows when it is not 0
shippingMoney—The shipping lines' sum in the display mode; a Shipping row shows when it is not 0
totalMoneyrequiredThe total to display
taxInclusiveboolean—The display tax mode, as WCPOS v2: true tags each tax row "Including tax" (the tax is already in the subtotal), false tags it "Excluding tax", and absent draws no tag
afterSubtotalReactNode—Rows rendered directly under Subtotal, e.g. a platform's coupon chips
showTotalbooleantrueDraws the Total row; pass false when the total shows elsewhere, e.g. v2's Checkout button
localestring—Locale for formatting the amounts
classNamestring—Override container styles

Live demo