Order and upsell
order is the order placed at checkout, on every page opened with ?ref_id (the checkout adds it). Nothing else is needed: an order.* path or an offer loads it.
CODE
<h1>Thanks, <span data-next-query="order.user.first_name"></span></h1>
<div data-next-each="order.lines">
<template>
<span data-next-query="product_title"></span> × <span data-next-query="quantity"></span>
<span data-next-query="total"></span>
</template>
</div>On the same pages an option is a post-purchase offer, added with data-next-action="acceptUpsell" and declined with skipUpsell (Action list).
Fields
| Field | Type | Present | |
|---|---|---|---|
ref_id | string | always | The order's reference: ref_id in post-purchase page URLs. |
number | string | optional | The order number customers see. |
currency | string | optional | ISO 4217, such as USD. |
test | boolean | always | true for a test order. |
paid | boolean | always | true once the order is paid; false while the shopper pays at a gateway. |
lines | OrderItem[] | always | |
coupons | string[] | always | The codes the shopper applied at checkout in this tab, uppercase. |
total_discount | number | always | The discounts on the order. |
shipping_method | Pick<ShippingMethod, "name" | "price"> & { tax?: number } | optional | The shipping method's name, its price, and the tax in that price. |
tax | number | always | The tax in the order: its lines' and shipping's. |
total | number | always | What the shopper paid. |
user | Pick<User, "first_name" | "last_name" | "email" | "phone"> | optional | |
shipping_address | Address | optional | |
billing_address | Address | optional | |
payment_method | string | optional | The API's code for the payment method, such as card_token or paypal. |
supports_upsells | boolean | always | true when upsells can be added to the order. |
status_url | string | optional | The order's status page on the store. |
OrderItem
One line of an order. Prices are numbers in the order's currency, as the shopper paid them.
| Field | Type | Present | |
|---|---|---|---|
id | string | always | The order line's id. |
product_id | number | optional | The product in the store. |
product_title | string | always | The product's name as customers see it. |
variant_id | number | optional | The product variant. |
variant_title | string | optional | The variant's name, such as Black / M. |
sku | string | optional | The product's Stock Keeping Unit. |
image | string | optional | |
quantity | number | always | |
price | number | always | What one unit cost after discounts. |
original_price | number | always | What one unit cost before discounts. |
total | number | always | What the line cost; price is total / quantity, rounded to the cent. |
tax | number | always | The tax in total; the line before tax is total − tax. |
upsell | boolean | always | true for a line an upsell added. |
User
The shopper, as the store's user on the Open Cart and the order.
| Field | Type | Present | |
|---|---|---|---|
email | string | optional | As typed, trimmed; none when data-trigger-on created the user without one. |
first_name | string | always | |
last_name | string | always | |
phone | string | optional | In E.164 once the address service read it, else the digits typed. |
accepts_marketing | boolean | always | The marketing checkbox, as sent with the Open Cart and the order. |
language | string | always | The language the store keeps for the shopper, such as en. |
ip | string | optional | The shopper's IP address, as the store recorded it with the Open Cart, else as the address service saw it; none when neither knows it. |
user_agent | string | always | As the store recorded it with the Open Cart, else the browser's. |
Address
A postal address as the shopper entered it, once every field its country requires is valid.
| Field | Type | Present | |
|---|---|---|---|
first_name | string | always | |
last_name | string | always | |
line1 | string | always | |
line2 | string | optional | |
city | string | optional | None in a country whose addresses have no city, such as Singapore. |
state | string | optional | The state or province code, in a country that has them. |
postcode | string | optional | |
country | string | always | ISO 3166-1 alpha-2. |
phone | string | optional | In E.164 once the address service read it, else the digits typed. |