Next Commerce
Data AttributesState

Properties

Properties you can read inside data-next-show and data-next-hide expressions, grouped by namespace.


Cart Properties

Booleans

PropertyDescription
cart.isEmptytrue when the cart has no items
cart.hasItemstrue when the cart has at least one item
cart.hasDiscounttrue when a discount or coupon is applied
cart.hasCoupontrue when a coupon code is applied
cart.hasShippingtrue when shipping is being charged

Numbers

PropertyDescription
cart.totalGrand total
cart.subtotalSubtotal before shipping/tax
cart.shippingShipping cost
cart.taxTax amount
cart.discountDiscount amount applied
cart.totalQuantityTotal number of units in the cart
cart.itemCountNumber of distinct line items

Functions

FunctionDescription
cart.hasItem(packageId)true when that package is in the cart
cart.hasPackage(packageId)Alias for hasItem
<div data-next-show="cart.hasItem(123)">
  Package 123 is in your cart
</div>

Package Properties

Read properties of a specific package by ID. Replace [id] with the package's ref_id.

PropertyDescription
package.[id].inStockBoolean
package.[id].hasDiscountBoolean
package.[id].hasSavingsBoolean
package.[id].quantityQuantity in cart
package.[id].priceNumeric price
<div data-next-show="package.123.inStock">
  In stock and ready to ship
</div>

Order Properties

Available on post-purchase pages where the order has been loaded via ?ref_id=.

PropertyDescription
order.existsOrder loaded successfully
order.isLoadingOrder is being fetched
order.hasErrorOrder failed to load
order.completedOrder is complete
order.hasItemsOrder has at least one line
order.hasShippingShipping was charged
order.hasTaxTax was charged
order.hasDiscountsDiscounts were applied
order.hasUpsellsOrder has upsell line items
order.supportsUpsellsThe order can accept post-purchase upsells
order.isTestTest order
order.totalNumeric total

See Order Data for the full list of order display fields.


Profile Properties

Read profile state for A/B testing and customer segmentation.

PropertyDescription
profile.activeThe active profile ID (string)
profile.existstrue when a profile is active
profile.is(name)true when the active profile matches name
<div data-next-show="profile.active === 'premium'">
  Premium member exclusive
</div>

<div data-next-show="profile.is('vip')">
  VIP perks
</div>

There are also dedicated profile attributes — data-next-show-if-profile and data-next-hide-if-profile — that take a comma-separated list:

<div data-next-show-if-profile="vip,premium,gold">
  Member benefits apply
</div>

URL Parameter Properties

Access URL query parameters as param.<name>. See URL Parameters for the full lifecycle.

<div data-next-show="param.variant == 'a'">
  Variant A only
</div>

<div data-next-show="param.preview">
  Shows whenever ?preview is in the URL, regardless of value
</div>

Selection Properties

When you have a selector with data-next-selector-id="<id>", read its current selection via selection.<id>.<property>.

PropertyDescription
selection.<id>.hasSelectionAt least one card is selected
selection.<id>.hasSavingsThe selected package has savings
selection.<id>.isBundleThe selected package is a multi-pack
selection.<id>.totalNumeric total for the selected package

See Selection for the full property list.


Null Safety

The conditional parser is null-safe. If you reference a property on something that does not exist (e.g., package.999.price when package 999 is not in the campaign), the expression evaluates to false and the element stays hidden — no console errors, no crashes.

<!-- Safe even if package 999 doesn't exist -->
<div data-next-show="package.999.price > 0"></div>

Next Steps

On this page