Next Commerce
Cart SystemReference

CSS Classes & State Attributes

CSS Classes

These classes are applied by the enhancers. Use them in CSS to style state changes.

Buttons and Toggles

ClassApplied toWhen
next-in-cartToggle button or containerThe package is in the cart
next-activeToggle buttonToggle is on
next-disabledButtonButton is disabled (e.g. during a cart write)

Selector Cards

ClassApplied toWhen
next-selectedSelector cardCard is currently selected
next-in-cartSelector cardAll card items are in the cart at the required quantities

Cart Summary Host Element

ClassApplied toWhen
next-cart-empty[data-next-cart-summary]Cart has no items
next-cart-has-items[data-next-cart-summary]Cart has one or more items
next-has-discounts[data-next-cart-summary]Discounts > 0
next-no-discounts[data-next-cart-summary]Discounts = 0
next-has-shipping[data-next-cart-summary]Shipping cost > 0
next-free-shipping[data-next-cart-summary]Shipping cost = 0
next-has-shipping-discount[data-next-cart-summary]A shipping discount is applied
next-no-shipping-discount[data-next-cart-summary]No shipping discount
next-calculating[data-next-cart-summary]Cart totals are being recalculated
next-not-calculating[data-next-cart-summary]Cart totals are up to date

Summary List Containers

ClassApplied toWhen
next-summary-empty[data-summary-offer-discounts], [data-summary-voucher-discounts], [data-summary-lines], [data-line-discounts]List has no items
next-summary-has-itemsSame containersList has one or more items

Usage Examples

Hide a discount row when no discounts are applied:

.next-no-discounts .discount-row { display: none }

Hide a shipping row when shipping is free:

.next-free-shipping .shipping-row { display: none }

Hide a per-line discount list when empty:

[data-line-discounts].next-summary-empty { display: none }

Style the selected card:

.next-selected {
  border: 2px solid blue;
  background: #f0f0ff;
}

Style an active toggle button:

button.next-active {
  background: green;
  color: white;
}

On this page