Attributes
Host Element
data-next-cart-summary
| Type | boolean (presence) |
| Required | yes |
Marks the element as a cart summary block. Place on the outermost container element.
<div data-next-cart-summary></div>Template Tokens
Place inside a <template> direct child of data-next-cart-summary. Unrecognized tokens are left unchanged.
| Token | Type | Description |
|---|---|---|
{subtotal} | currency | Sum of all line item prices at campaign rates — after sale pricing, before promotions and shipping |
{total} | currency | Grand total: subtotal + shipping − discounts |
{shipping} | currency / text | Shipping charge; "Free" when zero |
{shippingOriginal} | currency | Original shipping before a discount; empty string when no shipping discount is active |
{shippingDiscountAmount} | currency | Absolute amount saved on shipping |
{shippingDiscountPercentage} | percentage | Shipping discount as a percentage (e.g. "10%") |
{shippingName} | text | Display name of the selected shipping method |
{shippingCode} | text | Code of the selected shipping method |
{totalDiscount} | currency | Combined offer and voucher discount amount |
{totalDiscountPercentage} | percentage | Total discount as a percentage of subtotal (e.g. "20%") |
{discounts} | currency | Deprecated alias for {totalDiscount} — still rendered |
{currency} | text | Active currency code (e.g. "USD") |
{itemCount} | text | Number of distinct package lines in the cart (e.g. "3") |
{totalQuantity} | text | Total unit quantity across all lines (e.g. "5") |
{isEmpty} | text | "true" or "false" — whether the cart has no items |
{hasDiscounts} | text | "true" or "false" — whether any discount is applied |
{isFreeShipping} | text | "true" or "false" — whether shipping cost is zero |
{hasShippingDiscount} | text | "true" or "false" — whether a shipping discount is applied |
{isCalculating} | text | "true" or "false" — whether a totals recalculation is in progress |
List Container Attributes
Place these on elements inside a <template> child. Each container must also include a <template> child defining the row markup. A container without a <template> child is silently ignored.
All list containers receive these state classes after each render:
| Class | Condition |
|---|---|
next-summary-empty | No items in this list |
next-summary-has-items | One or more items in this list |
data-summary-lines
Renders one row per cart line. Lines are sorted by package_id ascending.
Row tokens: see Object Attributes → SummaryLine.
data-summary-offer-discounts
Renders one row per offer (promotion) discount.
Row tokens: {discount.name}, {discount.amount}, {discount.description}.
data-summary-voucher-discounts
Renders one row per voucher (coupon) discount.
Row tokens: {discount.name}, {discount.amount}, {discount.description}.
data-line-discounts
Place inside a data-summary-lines row template to render per-line discount breakdowns.
Row tokens: {discount.name}, {discount.amount}, {discount.description}.
Receives next-summary-empty / next-summary-has-items classes.
Per-Line Conditional Display
Inside any line or discount row template, use data-next-show and data-next-hide to render rows conditionally per row. Conditions are evaluated at render time against the same data used for token replacement, so you do not need any global setup. Hidden elements are removed from the DOM and the attribute is stripped, so global show/hide processing never re-processes them.
<ul data-summary-lines>
<template>
<li>
<span>{item.name}</span>
<span data-next-show="item.quantity > 1">×{item.quantity}</span>
<span data-next-hide="item.hasDiscount">{item.price}</span>
<span data-next-show="item.isRecurring">Renews {item.frequency}</span>
</li>
</template>
</ul>Syntax rules
- Use the no-braces syntax. Write
item.quantity > 1, not{item.quantity} > 1— the latter is substituted before evaluation and produces a malformed expression. - Supported operators:
>,>=,<,<=,==,===,!=,!==,&&,||,!, parentheses. - A bare property is interpreted as a truthy check:
data-next-show="item.isRecurring". - Conditions referencing other namespaces (e.g.
cart.hasItems) are passed through untouched and processed by the global show/hide system. Avoid cart-wide conditions inside line templates — they thrash on every cart re-render. Place them outside thedata-summary-linestemplate instead. - Function-call conditions (e.g.
item.hasFlag(x)) are not handled.
item.* namespace
Available in data-summary-lines row templates and inside any nested data-line-discounts template.
| Path | Type | Description |
|---|---|---|
item.packageId | number | Package ref_id |
item.name | string | Package display name |
item.image | string | Product image URL |
item.quantity | number | Unit quantity for this line |
item.productName | string | Product name |
item.variantName | string | Variant name (empty when no variant) |
item.sku | string | Product SKU |
item.isRecurring | boolean | Whether the line is a subscription |
item.interval | 'day' | 'month' | null | Subscription interval |
item.intervalCount | number | null | Subscription interval count |
item.frequency | string | Human-readable frequency (e.g. "Monthly", "Every 7 days") |
item.recurringPrice | number | null | Recurring unit price |
item.originalRecurringPrice | number | null | Original recurring unit price |
item.price | number | Package price after discounts |
item.originalPrice | number | Package price before discounts |
item.unitPrice | number | Unit price after discounts |
item.originalUnitPrice | number | Unit price before discounts |
item.discountAmount | number | Total discount on the line |
item.discountPercentage | number | Discount as a percentage of original (e.g. 25 for 25%) |
item.hasDiscount | boolean | Whether the line has any discount applied |
item.currency | string | Active currency code |
Raw values vs text tokens
The item.* paths used in conditions are raw types — item.hasDiscount is a real boolean, item.unitPrice is a real number. The same paths used as {item.*} text tokens still render as currency-formatted strings or "show" / "hide" for backwards compatibility.
discount.* namespace
Available in data-summary-offer-discounts, data-summary-voucher-discounts, and data-line-discounts row templates.
| Path | Type | Description |
|---|---|---|
discount.name | string | Offer or voucher name |
discount.amount | number | Discount amount as a raw number (currency symbols stripped) |
discount.amountFormatted | string | Original currency-formatted amount string |
discount.description | string | Offer or voucher description |
Examples
<!-- Show only when quantity > 1 -->
<span data-next-show="item.quantity > 1">×{item.quantity}</span>
<!-- Hide when the line has a discount -->
<span data-next-hide="item.hasDiscount">{item.price}</span>
<!-- Logical combinations -->
<span data-next-show="item.isRecurring && item.discountPercentage >= 10">
Subscriber bonus
</span>
<!-- NOT operator -->
<span data-next-show="!item.isRecurring">One-time purchase</span>
<!-- Discount-side conditions -->
<li data-next-show="discount.amount >= 5">{discount.name} -{discount.amountFormatted}</li>Cart Display — data-next-display
| Type | string |
| Required | yes |
| Format | cart.{property} |
Places a single reactive cart value on the element. Updates automatically on every cart change.
<span data-next-display="cart.total"></span>Supported properties
Financial totals
| Property | Format | Description |
|---|---|---|
cart.subtotal | currency | Subtotal before shipping and discounts |
cart.total | currency | Grand total after all discounts and shipping |
cart.totalDiscount | currency | Combined offer and voucher discount amount |
cart.totalDiscountPercentage | percentage | Total discount as a percentage of the subtotal |
cart.shipping | currency | Shipping cost |
cart.shippingOriginal | currency | Original shipping before a shipping discount; $0.00 when no discount |
cart.shippingDiscountAmount | currency | Absolute shipping discount |
cart.shippingDiscountPercentage | percentage | Shipping discount percentage |
cart.shippingName | text | Display name of the selected shipping method |
cart.shippingCode | text | Code of the selected shipping method |
Cart status
| Property | Format | Description |
|---|---|---|
cart.itemCount | number | Number of distinct line items |
cart.totalQuantity | number | Total unit quantity across all lines |
cart.isEmpty | boolean | "Yes" / "No" |
cart.hasDiscounts | boolean | "Yes" / "No" |
cart.isFreeShipping | boolean | "Yes" / "No" |
cart.hasShippingDiscount | boolean | "Yes" / "No" |
cart.isCalculating | boolean | "Yes" / "No" |
cart.currency | text | Active currency code (e.g. USD) |
Per-item quantity:
<span data-next-display="cart.items[2].quantity"></span>Optional modifiers
| Attribute | Effect |
|---|---|
data-hide-if-zero | Hide the element when the value is 0 |
data-hide-if-false | Hide the element when the value is falsy |
data-hide-zero-cents | Omit .00 from currency output |
data-next-format | Override format: currency, number, boolean, percentage, text, auto |