Next Commerce
Addon ToggleReference

Attributes

Container Attributes

AttributeDescription
data-next-package-toggleMarks the container (or the toggle element itself in single-element mode); required to activate the Addon Toggle
data-next-include-shippingtrue / false — include shipping costs in price totals shown via data-next-toggle-display
data-next-packagesJSON array of package definitions for auto-render mode; renders one card per entry when a template is also set
data-next-toggle-template-idID of a <template> element whose innerHTML is the card template
data-next-toggle-templateInline card template string (alternative to data-next-toggle-template-id)

Card Attributes

AttributeDescription
data-next-toggle-cardMarks an element as a toggleable card
data-next-package-idPackage ref_id — required per card
data-next-selected="true"Auto-adds this package on page load; deduped so the package is not added again if already in the cart
data-next-quantityQuantity to add when toggling on (default 1); ignored when data-next-package-sync is set
data-next-package-syncComma-separated list of package IDs — quantity mirrors the sum of those packages currently in the cart
data-next-is-upsell="true"Marks the item as an upsell/bump for order tracking
data-add-textText shown in the button text slot when the package is not in the cart
data-remove-textText shown in the button text slot when the package is in the cart

Display Slot Attributes

Place these on elements inside a card (or card template) to populate them with price and state data.

AttributeDescription
data-next-toggle-displayPrimary display slot. Value is a field name (see table below).
data-next-toggle-priceDeprecated. Accepts the same field names as data-next-toggle-display. Supported for backward compatibility.

Supported field names (work with both attributes):

FieldEffect
priceFormatted total price for the card's quantity
unitPricePer-unit price
originalPriceRetail / compare-at total price
originalUnitPriceRetail / compare-at per-unit price
discountAmountSavings amount; empty if no discount
discountPercentageSavings as a percentage; empty if no discount
namePackage display name
isSelectedShown when the package is in the cart; hidden otherwise
hasDiscountShown when a discount applies; hidden otherwise
isRecurringShown when the package bills on a recurring schedule; hidden otherwise
recurringPriceRecurring charge total (quantity-scaled)
intervalBilling interval: "day" or "month"
intervalCountNumber of intervals between billing cycles
frequencyHuman-readable cadence: "Per month", "Every 3 months", "One time"
currencyISO 4217 currency code

State Container Attribute

AttributeDescription
data-next-toggle-containerMarks an ancestor element as the state container for cards inside it. State classes and attributes are applied to this element rather than to each card. See State Containers

Attributes Set Automatically

On each card element:

AttributeValuesWhen set
data-next-in-cart"true" / "false"Updated on every cart sync
data-next-loading"true" / "false"Set while a cart operation or price fetch is in progress

On the state container (when one is found):

AttributeValuesDescription
data-in-cart"true" / "false"Whether the package is in the cart
data-next-active"true" / "false"Alias for data-in-cart

Display System Integration

Use data-next-display="toggle.{packageId}.{property}" on any element to bind it to a specific card's price or state. {packageId} must match data-next-package-id on the card.

Supported properties:

PropertyFormatDescription
isSelectedbooleantrue when this package is in the cart
nametextDisplay name from the campaign package
pricecurrencyTotal price for the card's quantity (unit price × quantity)
unitPricecurrencyPer-unit price
originalPricecurrencyRetail / compare-at total price
originalUnitPricecurrencyRetail / compare-at per-unit price
discountAmountcurrencySavings amount (compare minus total)
discountPercentagepercentageDiscount as a percentage of the compare price
hasDiscountbooleantrue when a discount is applied
isRecurringbooleantrue when the package bills on a recurring schedule
recurringPricecurrencyRecurring charge total (quantity-scaled)
intervaltextBilling interval: "day" or "month"
intervalCountautoNumber of intervals between billing cycles
frequencytextHuman-readable billing cadence: "Per month", "Every 3 months", "One time"
currencytextISO 4217 currency code

Supports all standard display modifiers: data-next-format, data-hide-if-zero, data-hide-if-false.

On this page