Next Commerce
Cart SummaryReference

CSS Classes

Host Element State Classes

Applied to the data-next-cart-summary host element on every render. Use these in CSS to show or hide rows without JavaScript.

ClassCondition
next-cart-emptyCart has no items
next-cart-has-itemsCart has one or more items
next-has-discountsTotal discount amount > 0
next-no-discountsTotal discount amount = 0
next-has-shippingShipping cost > 0
next-free-shippingShipping cost = 0
next-has-shipping-discountA shipping discount is applied
next-no-shipping-discountNo shipping discount
next-calculatingTotals recalculation is in progress
next-not-calculatingTotals are up to date

Common patterns:

/* Hide discount row when no discount is active */
.next-no-discounts .discount-row { display: none; }

/* Hide shipping row when shipping is free */
.next-free-shipping .shipping-row { display: none; }

/* Hide the strikethrough shipping original when no shipping discount */
.next-no-shipping-discount .original-shipping { display: none; }

/* Show a loading indicator while recalculating */
.next-calculating .spinner { display: block; }
.next-not-calculating .spinner { display: none; }

Default Layout Row Classes

When no <template> child is present, the built-in layout renders rows with these classes:

ClassApplied to
next-summary-rowEvery row wrapper
next-summary-labelLabel cell in each row
next-summary-valueValue cell in each row
next-row-subtotalSubtotal row
next-row-discountsDiscounts row (only rendered when discounts are non-zero)
next-row-shippingShipping row
next-row-totalTotal row

List Container State Classes

Applied to data-summary-lines, data-summary-offer-discounts, data-summary-voucher-discounts, and data-line-discounts containers after each render.

ClassCondition
next-summary-emptyNo items in the list
next-summary-has-itemsOne or more items in the list
/* Hide an empty discount section */
.next-summary-empty { display: none; }

On this page