Skip to content

Order Data Attributes

Order attributes display order confirmation data on thank you pages and post-purchase flows.

The order data is automatically loaded when the URL contains ?ref_id=ORDER_ID and provides access to complete order information including customer details, line items, pricing, addresses, and attribution data.

Orders automatically load when the URL contains the ref_id parameter:

https://example.com/confirmation?ref_id=ORDER_123

The SDK detects this parameter and loads the complete order data, making all order.* attributes available for display.

Order data has three states that should be handled in your confirmation page:

<!-- Loading state -->
<div data-next-show="order.isLoading">
<p>Loading your order...</p>
</div>
<!-- Error state -->
<div data-next-show="order.hasError">
<p>Unable to load order</p>
<p data-next-display="order.errorMessage">Error details</p>
</div>
<!-- Success state -->
<div data-next-show="order.exists" data-next-hide="order.isLoading">
<!-- Order content here -->
</div>

The SDK automatically adds CSS classes to help with styling:

  • .next-loading - Applied when order is loading
  • .next-loaded - Applied when order loaded successfully
  • .next-error - Applied when error occurred

Display order identification, status, and metadata.

<!-- Order identification -->
<span data-next-display="order.id">12345</span>
<span data-next-display="order.number">ORD-001</span>
<span data-next-display="order.ref_id">abc123xyz</span>
<span data-next-display="order.refId">abc123xyz</span>
<!-- Order status and metadata -->
<span data-next-display="order.status">Processing</span>
<span data-next-display="order.created_at">2024-01-15</span>
<span data-next-display="order.createdAt">2024-01-15</span>
<span data-next-display="order.currency">USD</span>
<!-- Order status URL -->
<a data-next-display="order.order_status_url">View Order Status</a>
<a data-next-display="order.statusUrl">View Order Status</a>

Display a badge when the order is a test transaction:

<!-- Test order indicator -->
<span data-next-display="order.testBadge">🧪 TEST ORDER</span>
<!-- Conditional test order warning -->
<div data-next-show="order.isTest">
<p>This is a test order</p>
</div>
PropertyDescriptionType
order.idOrder ID numberString/Number
order.numberHuman-readable order numberString/Number
order.ref_idReference ID (snake_case)String
order.refIdReference ID (camelCase)String
order.statusOrder statusString
order.is_testTest order flag (snake_case)Boolean
order.isTestTest order flag (camelCase)Boolean
order.testBadge”🧪 TEST ORDER” text or emptyString
order.order_status_urlOrder status URL (snake_case)String (URL)
order.statusUrlOrder status URL (camelCase)String (URL)
order.created_atOrder creation date (snake_case)String
order.createdAtOrder creation date (camelCase)String
order.currencyCurrency codeString
order.supports_upsellsSupports upsells (snake_case)Boolean
order.supportsUpsellsSupports upsells (camelCase)Boolean

Display order totals, taxes, shipping, and discounts.

Order totals have specific meanings:

  • order.subtotal - Line items only (excludes shipping and tax)
  • order.total_excl_tax - Total excluding tax but INCLUDING shipping
  • order.total - Grand total including everything (products + shipping + tax)
<!-- Main totals -->
<div>Subtotal: <span data-next-display="order.subtotal">$0.00</span></div>
<div>Shipping: <span data-next-display="order.shipping">$0.00</span></div>
<div>Tax: <span data-next-display="order.tax">$0.00</span></div>
<div>Total: <span data-next-display="order.total">$0.00</span></div>
<div class="order-summary">
<!-- Line items subtotal -->
<div class="line-item">
<span>Subtotal:</span>
<span data-next-display="order.subtotal">$0.00</span>
</div>
<!-- Shipping -->
<div class="line-item" data-next-show="order.hasShipping">
<span>Shipping:</span>
<span data-next-display="order.shipping">$0.00</span>
</div>
<!-- Tax -->
<div class="line-item" data-next-show="order.hasTax">
<span>Tax:</span>
<span data-next-display="order.tax">$0.00</span>
</div>
<!-- Discounts -->
<div class="line-item" data-next-show="order.hasDiscounts">
<span>Discount:</span>
<span>-<span data-next-display="order.discounts">$0.00</span></span>
</div>
<!-- Savings -->
<div class="line-item" data-next-show="order.hasSavings">
<span>You saved:</span>
<span>
<span data-next-display="order.savingsAmount">$0.00</span>
(<span data-next-display="order.savingsPercentage">0</span>%)
</span>
</div>
<!-- Grand total -->
<div class="line-item total">
<span>Total:</span>
<span data-next-display="order.total">$0.00</span>
</div>
</div>
PropertyDescriptionType
order.total_incl_taxGrand total including tax and shippingCurrency
order.totalGrand total (alias)Currency
order.subtotalLine items onlyCurrency
order.subtotalExclShippingLine items only (alias)Currency
order.total_excl_taxTotal excluding tax (includes shipping)Currency
order.total_taxTax amount (snake_case)Currency
order.taxTax amount (alias)Currency
order.shipping_incl_taxShipping including tax (snake_case)Currency
order.shippingShipping including tax (alias)Currency
order.shipping_excl_taxShipping excluding tax (snake_case)Currency
order.shippingExclTaxShipping excluding tax (camelCase)Currency
order.shipping_taxShipping tax amount (snake_case)Currency
order.shippingTaxShipping tax amount (camelCase)Currency
order.total_discountsTotal discounts (snake_case)Currency
order.discountsTotal discounts (alias)Currency
order.savingsAmountCalculated savings amountCurrency
order.savingsPercentageSavings percentageNumber
order.payment_methodPayment method (snake_case)String
order.paymentMethodPayment method (camelCase)String
order.shipping_methodShipping method (snake_case)String
order.shippingMethodShipping method (camelCase)String

Use the .raw suffix to get numeric values for mathematical operations:

<!-- Calculate shipping percentage -->
<span data-next-display="order.shipping.raw"
data-divide-by="order.total.raw"
data-multiply-by="100"
data-format="number">0</span>%
PropertyDescriptionType
order.total.rawTotal as numberNumber
order.subtotal.rawSubtotal as numberNumber
order.tax.rawTax as numberNumber
order.shipping.rawShipping as numberNumber
order.discounts.rawDiscounts as numberNumber

Display customer contact details and preferences.

<!-- Basic customer info -->
<div class="customer-info">
<p><span data-next-display="order.customer.name">John Doe</span></p>
<p><span data-next-display="order.customer.email">[email protected]</span></p>
<p data-next-show="order.customer.phone">
Phone: <span data-next-display="order.customer.phone">555-123-4567</span>
</p>
</div>
<!-- Marketing opt-in status -->
<div data-next-show="order.customer.acceptsMarketing">
✓ Subscribed to marketing emails
</div>
PropertyDescriptionType
order.customer.nameFull customer nameString
order.customer.firstNameFirst name onlyString
order.customer.lastNameLast name onlyString
order.customer.emailCustomer emailString
order.customer.phoneCustomer phoneString
order.customer.acceptsMarketingMarketing opt-inBoolean
order.customer.languageCustomer languageString
order.customer.ipCustomer IP addressString

order.user.* is an alias for order.customer.* and provides the same properties:

<!-- These are equivalent -->
<span data-next-display="order.customer.name">John Doe</span>
<span data-next-display="order.user.name">John Doe</span>
PropertyDescriptionType
order.user.nameFull name (alias)String
order.user.firstNameFirst name (alias)String
order.user.lastNameLast name (alias)String
order.user.emailEmail (alias)String
order.user.phonePhone (alias)String

Display shipping and billing addresses.

<div class="shipping-address">
<h3>Shipping Address</h3>
<address>
<span data-next-display="order.shippingAddress.name">-</span><br>
<span data-next-display="order.shippingAddress.line1">-</span><br>
<span data-next-show="order.shippingAddress.line2">
<span data-next-display="order.shippingAddress.line2">-</span><br>
</span>
<span data-next-display="order.shippingAddress.city">-</span>,
<span data-next-display="order.shippingAddress.state">-</span>
<span data-next-display="order.shippingAddress.zip">-</span><br>
<span data-next-display="order.shippingAddress.country">-</span>
</address>
</div>

Use the .full property to get a pre-formatted address string:

<address data-next-display="order.shippingAddress.full">
123 Main St, Springfield, IL 62701, USA
</address>
PropertyDescriptionType
order.shippingAddress.fullFull formatted addressString
order.shippingAddress.nameRecipient nameString
order.shippingAddress.line1Address line 1String
order.shippingAddress.line2Address line 2String
order.shippingAddress.cityCityString
order.shippingAddress.stateState/ProvinceString
order.shippingAddress.zipZIP codeString
order.shippingAddress.postcodePostcode (alias)String
order.shippingAddress.countryCountryString
order.shippingAddress.phonePhone numberString

Billing address has identical properties to shipping address:

<div class="billing-address">
<h3>Billing Address</h3>
<address data-next-display="order.billingAddress.full">-</address>
</div>
PropertyDescriptionType
order.billingAddress.fullFull formatted addressString
order.billingAddress.nameRecipient nameString
order.billingAddress.line1Address line 1String
order.billingAddress.line2Address line 2String
order.billingAddress.cityCityString
order.billingAddress.stateState/ProvinceString
order.billingAddress.zipZIP codeString
order.billingAddress.postcodePostcode (alias)String
order.billingAddress.countryCountryString
order.billingAddress.phonePhone numberString

Display order items and product details.

<!-- Total counts -->
<p>Items: <span data-next-display="order.lines.count">0</span></p>
<p>Quantity: <span data-next-display="order.lines.totalQuantity">0</span></p>
<!-- Main product -->
<h4 data-next-display="order.lines.mainProduct">Product Name</h4>
<p>SKU: <span data-next-display="order.lines.mainProductSku">-</span></p>
<!-- Upsell count -->
<p data-next-show="order.hasUpsells">
Includes <span data-next-display="order.lines.upsellCount">0</span> bonus item(s)
</p>
PropertyDescriptionType
order.lines.countNumber of line itemsNumber
order.lines.totalQuantityTotal quantity of all itemsNumber
order.lines.upsellCountNumber of upsell itemsNumber
order.lines.mainProductMain product title (first item)String
order.lines.mainProductSkuMain product SKU (first item)String
order.items.countLine item count (alias)Number
order.items.totalQuantityTotal quantity (alias)Number

Access specific line items using array index notation:

<!-- First item (index 0) -->
<div class="order-item">
<h4 data-next-display="order.lines[0].title">Product Name</h4>
<p>SKU: <span data-next-display="order.lines[0].sku">-</span></p>
<p>Quantity: <span data-next-display="order.lines[0].quantity">1</span></p>
<p>Price: <span data-next-display="order.lines[0].price">$0.00</span></p>
<p>Total: <span data-next-display="order.lines[0].total">$0.00</span></p>
</div>
<!-- Second item (index 1) -->
<div class="order-item">
<h4 data-next-display="order.lines[1].title">Product Name</h4>
</div>
PropertyDescriptionType
order.lines[n].titleProduct titleString
order.lines[n].product_titleProduct title (snake_case)String
order.lines[n].skuProduct SKUString
order.lines[n].product_skuProduct SKU (snake_case)String
order.lines[n].quantityQuantity orderedNumber
order.lines[n].imageProduct image URLString (URL)
order.lines[n].priceUnit price including taxCurrency
order.lines[n].priceExclTaxUnit price excluding taxCurrency
order.lines[n].priceExclTaxExclDiscountsOriginal price before discountsCurrency
order.lines[n].priceInclTaxExclDiscountsOriginal price with tax before discountsCurrency
order.lines[n].totalLine total including taxCurrency
order.lines[n].totalExclTaxLine total excluding taxCurrency
order.lines[n].isUpsellIs upsell itemBoolean

Use .raw for numeric calculations:

PropertyDescriptionType
order.lines[n].price.rawUnit price as numberNumber
order.lines[n].priceExclTax.rawUnit price excl tax as numberNumber
order.lines[n].priceExclTaxExclDiscounts.rawOriginal price as numberNumber
order.lines[n].priceInclTaxExclDiscounts.rawOriginal price with tax as numberNumber
order.lines[n].total.rawLine total as numberNumber
order.lines[n].totalExclTax.rawLine total excl tax as numberNumber

The data-next-order-items attribute automatically renders all line items using customizable templates.

<div data-next-order-items class="order-items-list">
<div class="order-item">
<h4>{item.name}</h4>
<span>Qty: {item.quantity}</span>
<span>{item.lineTotal}</span>
</div>
</div>

Templates can be defined in multiple ways:

<!-- Define template -->
<template id="order-item-template">
<div class="order-item">
<img src="{item.image}" alt="{item.name}">
<h4>{item.name}</h4>
<span>Qty: {item.quantity}</span>
<span>{item.lineTotal}</span>
</div>
</template>
<!-- Reference template -->
<div data-next-order-items
data-item-template-id="order-item-template">
</div>
<div data-next-order-items
data-item-template='<div class="item">{item.name} x{item.quantity}: {item.lineTotal}</div>'>
</div>
VariableDescriptionType
{item.id}Order line IDString
{item.name}Product nameString
{item.title}Product title (alias)String
{item.sku}Product SKUString
{item.quantity}Quantity orderedNumber
{item.description}Product descriptionString
{item.variant}Variant titleString
{item.image}Product image URLString
VariableDescriptionType
{item.price}Unit price including taxCurrency
{item.priceExclTax}Unit price excluding taxCurrency
{item.unitTax}Tax per unitCurrency
{item.lineTotal}Line total including taxCurrency
{item.lineTotalExclTax}Line total excluding taxCurrency
{item.lineTax}Total tax for lineCurrency
VariableDescriptionType
{item.priceExclDiscounts}Original unit price (incl tax)Currency
{item.priceExclTaxExclDiscounts}Original unit price (excl tax)Currency
{item.lineTotalExclDiscounts}Original line total (incl tax)Currency
{item.lineTotalExclTaxExclDiscounts}Original line total (excl tax)Currency
{item.unitDiscount}Discount per unitCurrency
{item.lineDiscount}Total line discountCurrency
VariableDescriptionValue
{item.isUpsell}Is upsell item”true” or “false”
{item.upsellBadge}Upsell badge text”UPSELL” or ""
{item.hasImage}Has image”true” or “false”
{item.hasDescription}Has description”true” or “false”
{item.hasVariant}Has variant”true” or “false”
{item.hasTax}Has tax”true” or “false”
{item.hasDiscount}Has discount”true” or “false”
VariableDescriptionValue
{item.showUpsell}Show upsell badge”show” or “hide”
{item.showImage}Show image”show” or “hide”
{item.showDescription}Show description”show” or “hide”
{item.showVariant}Show variant”show” or “hide”
{item.showTax}Show tax”show” or “hide”
{item.showDiscount}Show discount”show” or “hide”
<!-- Template definition -->
<template id="order-item-template">
<div class="order-item" data-order-line-id="{item.id}">
<div class="order-item__image {item.showImage}">
<img src="{item.image}" alt="{item.name}">
</div>
<div class="order-item__details">
<h4 class="order-item__name">
{item.name}
<span class="upsell-badge {item.showUpsell}">{item.upsellBadge}</span>
</h4>
<div class="order-item__sku">SKU: {item.sku}</div>
<div class="order-item__variant {item.showVariant}">{item.variant}</div>
</div>
<div class="order-item__quantity">
Qty: {item.quantity}
</div>
<div class="order-item__pricing">
<div class="price">
<span class="original {item.showDiscount}">
{item.priceExclTaxExclDiscounts}
</span>
<span class="current">{item.priceExclTax}</span>
</div>
<div class="total">{item.lineTotal}</div>
<div class="discount {item.showDiscount}">
Saved: {item.lineDiscount}
</div>
</div>
</div>
</template>
<!-- Order items container -->
<div data-next-order-items
data-item-template-id="order-item-template"
data-empty-template='<p>No items in this order</p>'>
</div>

Display a message when the order has no items:

<div data-next-order-items
data-item-template-id="order-item-template"
data-empty-template="<p>No items found</p>">
</div>

Display marketing attribution and campaign tracking data.

<!-- UTM parameters -->
<div data-next-show="order.attribution.hasTracking">
<h3>Campaign Information</h3>
<p data-next-show="order.attribution.utm_source">
Source: <span data-next-display="order.attribution.utm_source">-</span>
</p>
<p data-next-show="order.attribution.utm_medium">
Medium: <span data-next-display="order.attribution.utm_medium">-</span>
</p>
<p data-next-show="order.attribution.utm_campaign">
Campaign: <span data-next-display="order.attribution.utm_campaign">-</span>
</p>
<p data-next-show="order.attribution.affiliate">
Affiliate: <span data-next-display="order.attribution.affiliate">-</span>
</p>
</div>
PropertyDescriptionType
order.attribution.utm_sourceUTM source (snake_case)String
order.attribution.sourceUTM source (alias)String
order.attribution.utm_mediumUTM medium (snake_case)String
order.attribution.mediumUTM medium (alias)String
order.attribution.utm_campaignUTM campaign (snake_case)String
order.attribution.campaignUTM campaign (alias)String
order.attribution.utm_termUTM term (snake_case)String
order.attribution.termUTM term (alias)String
order.attribution.utm_contentUTM content (snake_case)String
order.attribution.contentUTM content (alias)String
order.attribution.gclidGoogle Click IDString
order.attribution.funnelFunnel nameString
order.attribution.affiliateAffiliate codeString
order.attribution.hasTrackingHas any tracking dataBoolean

Use boolean properties with data-next-show and data-next-hide for conditional display.

<!-- Order loading/error states -->
<div data-next-show="order.exists">Order loaded successfully</div>
<div data-next-show="order.isLoading">Loading order...</div>
<div data-next-show="order.hasError">Error loading order</div>
<!-- Order content flags -->
<div data-next-show="order.hasItems">Order has items</div>
<div data-next-show="order.isEmpty">Order is empty</div>
<div data-next-show="order.hasShipping">Shipping was charged</div>
<div data-next-show="order.hasTax">Tax was charged</div>
<div data-next-show="order.hasDiscounts">Discounts applied</div>
<div data-next-show="order.hasSavings">Customer saved money</div>
<div data-next-show="order.hasUpsells">Order includes upsells</div>
<!-- Order timing -->
<div data-next-show="order.isRecent">Order placed recently</div>
<div data-next-show="order.isNewOrder">New order (< 15 min)</div>
<div data-next-show="order.supportsUpsells">Can add more items</div>
PropertyDescriptionType
order.existsOrder loaded successfullyBoolean
order.isLoadingOrder is loadingBoolean
order.hasErrorError occurredBoolean
order.isTestIs test orderBoolean
order.hasItemsOrder has line itemsBoolean
order.isEmptyOrder is emptyBoolean
order.hasShippingShipping chargedBoolean
order.hasTaxTax chargedBoolean
order.hasDiscountsDiscounts appliedBoolean
order.hasSavingsHas savings amountBoolean
order.hasUpsellsHas upsell itemsBoolean
order.supportsUpsellsCan add more itemsBoolean
order.isRecentPlaced < 15 minutes agoBoolean
order.isExpiredPlaced > 15 minutes agoBoolean
order.isNewOrderNew order (< 15 min)Boolean

Display error messages when orders fail to load:

<div data-next-show="order.hasError" class="error-message">
<h2>Unable to Load Order</h2>
<p data-next-display="order.errorMessage">Error details</p>
<p>Please check your email for order confirmation.</p>
</div>
<div class="order-confirmation">
<!-- Loading state -->
<div data-next-show="order.isLoading">
<p>Loading your order...</p>
</div>
<!-- Error state -->
<div data-next-show="order.hasError">
<h2>Order Not Found</h2>
<p data-next-display="order.errorMessage">-</p>
</div>
<!-- Order content -->
<div data-next-show="order.exists" data-next-hide="order.isLoading">
<h1>Thank You for Your Order!</h1>
<!-- Test order warning -->
<div data-next-show="order.isTest">
<p data-next-display="order.testBadge"></p>
</div>
<!-- Order header -->
<div class="order-header">
<p>Order #<span data-next-display="order.number">-</span></p>
<p>Reference: <span data-next-display="order.refId">-</span></p>
<p>Placed on <span data-next-display="order.createdAt">-</span></p>
</div>
<!-- Customer info -->
<div class="customer-info">
<h3>Customer Information</h3>
<p><span data-next-display="order.customer.name">-</span></p>
<p><span data-next-display="order.customer.email">-</span></p>
</div>
<!-- Addresses -->
<div class="addresses">
<div class="shipping-address">
<h3>Shipping Address</h3>
<address data-next-display="order.shippingAddress.full">-</address>
</div>
<div class="billing-address">
<h3>Billing Address</h3>
<address data-next-display="order.billingAddress.full">-</address>
</div>
</div>
<!-- Order items -->
<div class="order-items">
<h3>Order Items</h3>
<div data-next-order-items>
<div class="item">
<h4>{item.name}</h4>
<span>Qty: {item.quantity}</span>
<span>{item.lineTotal}</span>
</div>
</div>
</div>
<!-- Order summary -->
<div class="order-summary">
<h3>Order Summary</h3>
<div class="line-item">
<span>Subtotal:</span>
<span data-next-display="order.subtotal">$0.00</span>
</div>
<div class="line-item" data-next-show="order.hasShipping">
<span>Shipping:</span>
<span data-next-display="order.shipping">$0.00</span>
</div>
<div class="line-item" data-next-show="order.hasTax">
<span>Tax:</span>
<span data-next-display="order.tax">$0.00</span>
</div>
<div class="line-item total">
<span>Total:</span>
<span data-next-display="order.total">$0.00</span>
</div>
</div>
<!-- Order status link -->
<a data-next-display="order.statusUrl" class="btn">
View Order Status
</a>
</div>
</div>