Next Commerce
UpsellsReference

Attributes

Every attribute the upsell enhancers read, grouped by where it goes.


Accept Upsell Button

Activated by data-next-action="accept-upsell" on a button element.

AttributeRequiredDescription
data-next-action="accept-upsell"yesActivates the enhancer
data-next-package-idconditionalNumeric package ref_id. Required unless a data-next-selector-id or data-next-upsell-action-for is set
data-next-quantitynoNumber of units to submit. Defaults to 1
data-next-selector-idconditionalLinks the button to a PackageSelectorEnhancer running in upsell context. Value must match the selector container's data-next-selector-id
data-next-upsell-action-forconditionalLinks the button to a BundleSelectorEnhancer running in upsell context. Value must match the bundle selector container's data-next-selector-id. This is a different attribute from data-next-selector-id
data-next-urlnoURL to navigate to after a successful submit. Falls back to <meta name="next-upsell-accept-url">

If both data-next-package-id and data-next-selector-id are set, the selector wins when a selection has been made.


Offer Container

Activated by data-next-upsell="offer" on any container element.

AttributeRequiredDescription
data-next-upsell="offer"yesActivates the enhancer in single-package mode
data-next-package-idconditionalNumeric package ref_id. Required in single-package mode
data-next-quantitynoDefault quantity. Defaults to 1
data-next-selector-idnoUnique ID for this container, used by cross-container option/quantity sync and external display elements
data-next-package-selector-idnoLink to an external PackageSelectorEnhancer instead of using inline options. Auto-detected when a [data-next-package-selector] child is present
data-next-bundle-selector-idnoLink to an external BundleSelectorEnhancer. Auto-detected when a [data-next-bundle-selector] child is present

Selector Container (built-in options)

Activated by data-next-upsell-selector on any container element. Used when the offer card holds a list of option cards.

AttributeRequiredDescription
data-next-upsell-selectoryesMarks the container as an upsell selector
data-next-selector-idyesUnique ID for this selector. Used by data-next-upsell-select, cross-container sync, and external display elements

Option Cards

AttributeRequiredDescription
data-next-upsell-optionyesMarks an element as a selectable option card
data-next-package-idyesNumeric package ref_id for this option
data-next-selected="true"noPre-selects this option on init
AttributeRequiredDescription
data-next-upsell-select="<selectorId>"yesMarks a <select> element. Value must match the parent data-next-selector-id (or be set on a standalone <select>)

Each <option value="N"> inside is a package ID. An empty value clears the selection.


Action Buttons (inside an offer container)

Place inside a data-next-upsell="offer" or data-next-upsell-selector container.

AttributeValuesDescription
data-next-upsell-actionadd, accept, skip, declineAction to perform on click. add and accept are aliases. skip and decline are aliases
data-next-urlURLPer-button override for the redirect target. Falls back to the <meta name="next-upsell-accept-url"> or next-upsell-decline-url meta tag

data-os-next-url and data-next-next-url are accepted as legacy aliases for data-next-url.


Quantity Controls (inside an offer container)

AttributeDescription
data-next-upsell-quantity="increase"Increment button. Clamps at 10
data-next-upsell-quantity="decrease"Decrement button. Clamps at 1
data-next-upsell-quantity="display"Element whose text content is updated to the current quantity
data-next-upsell-quantity-toggle="N"Card that sets quantity to N on click. Gets next-selected when N matches the current quantity
data-next-quantity-selector-idOptional. On increase/decrease buttons or display elements, scopes the quantity to a specific selector ID rather than the container default

Linked External Selectors

When the offer container or accept button is paired with an external selector, the selector itself needs upsell context to disable cart writes.

AttributeOnDescription
data-next-upsell-context[data-next-package-selector] or [data-next-bundle-selector]Forces the selector into select mode and disables all cart writes. Required on any selector linked to an upsell

Meta Tags

Set in the page <head>. Read by both upsell enhancers.

Meta tagDescription
<meta name="next-page-type" content="upsell">Marks the page as an upsell page. Triggers page-view tracking and the duplicate-dialog logic
<meta name="next-upsell-accept-url" content="/path">Default URL to navigate to after a successful accept. Overridden by data-next-url on individual buttons
<meta name="next-upsell-decline-url" content="/path">Default URL to navigate to after a skip or a duplicate-decline
<meta name="next-prevent-back-navigation" content="true">Push a history guard so the customer cannot use the browser Back button to return to checkout. Use only on the first upsell page

Display Bindings

Use data-next-display inside an offer container to bind any element to the package's data. The display updates when the option or quantity changes.

BindingFormatDescription
data-next-display="package.name"textPackage name
data-next-display="package.image"textImage URL
data-next-display="package.price"currencyUnit price after discount
data-next-display="package.originalPrice"currencyUnit price before discount
data-next-display="package.savingsAmount"currencyDiscount per unit
data-next-display="package.savingsPercentage"percentageDiscount as a percentage
data-next-display="package.hasSavings"booleantrue when discount is non-zero. Use with data-next-show

External display elements (outside the container) can bind to a specific selector via data-next-display="selection.<selectorId>.<property>".

On this page