Next Commerce
Data AttributesDisplayReference

Attributes

Every display attribute and modifier in one table.


Activation

AttributeDescription
data-next-display="<path>"Bind the element's text content to the value at <path>
data-next-cart-itemsActivate the cart items renderer on the container — see Cart Items Template
data-next-order-itemsActivate the order items renderer — see Order Data → Order Items Template

Display Path Namespaces

Use any of these inside data-next-display:

NamespaceSourceSee
cart.*Cart storeDisplay Paths → Cart
package.[id].*Campaign storePackage Display
campaign.*Campaign store (root level)Campaign Attributes
order.*Order storeOrder Data → Properties
profile.*Profile storeState → Properties
selection.<id>.*Active selector stateSelection

Formatting Modifiers

AttributeValuesDescription
data-formatcurrency, number, integer, percentage, autoOutput format
data-hide-zero-centstrue / falseOmit .00 for round numbers
data-decimal-placesintegerOverride default decimal places

See Configuration → Formatting.


Visibility Modifiers

AttributeDescription
data-hide-if-zeroHide the element when the value is 0
data-hide-if-falseHide the element when the value is false (or any falsy value)

For visibility based on a separate state expression, use data-next-show / data-next-hide instead.


Math Modifiers

AttributeOperation
data-multiply-byvalue × operand
data-divide-byvalue ÷ operand
data-addvalue + operand
data-subtractvalue − operand

The operand can be a literal number or another display path. See Configuration → Math.


Raw Numeric Values

Append .raw to a numeric path to get the underlying number rather than the formatted string. Required when the value is the input to a math operator.

<span data-next-display="cart.total.raw"
      data-multiply-by="0.1"
      data-format="currency">$9.90</span>

Available on most numeric paths: cart.total.raw, package.[id].price.raw, order.total.raw, selection.<id>.total.raw, etc.


Package Context Shorthand

When the element lives inside an element with data-next-package-id="<id>", you can omit the ID from the path:

Inside parentInside child element
data-next-package-id="123"data-next-display="package.price"

This resolves to package.123.price automatically. See Package Display.


Cart Items Template Variables

Inside a data-next-cart-items container, use {item.*} syntax in the template instead of data-next-display. See Cart Items Template for the full variable list.


Order Items Template Variables

Inside a data-next-order-items container, use {item.*} syntax in the template. See Order Data → Order Items Template for the full variable list.


Fallback Content

The element's existing text content is shown until the SDK initializes. Always provide a meaningful fallback so the page renders correctly with JavaScript disabled.

<span data-next-display="cart.total">$0.00</span>
<span data-next-display="package.42.name">Loading...</span>

Performance Tips

  • Use specific paths. cart.total is faster than cart.items[0].lineTotal because it reads a precomputed value rather than walking the cart.
  • Combine related conditions. A single data-next-show="cart.hasItems && cart.total > 0" is faster than nesting two conditional elements.
  • Hide on parent containers. Putting data-next-show on a wrapper avoids re-evaluating the same condition for each child.

On this page