Order Variables Accessible on Order Success Page
Below are the variables accessible to JavaScript snippets (tracking pixels) added to the Order Success Page
<script>
console.log({
orderNumber: '[orderNumber]',
orderValue: '[orderValue]',
orderSubtotal: '[orderSubtotal]',
orderItems: '[orderItems]',
currencyCode: '[currencyCode]',
discountAmount: '[discountAmount]',
couponCode: '[couponCode]',
orderSubtotalMinusDiscountWithoutTax: '[orderSubtotalMinusDiscountWithoutTax]',
orderSubtotalMinusDiscountWithTax: '[orderSubtotalMinusDiscountWithTax]',
shippingAmount: '[shippingAmount]',
taxAmount: '[taxAmount]',
customerFirstName: '[customerFirstName]',
customerLastName: '[customerLastName]',
customerEmail: '[customerEmail]',
billingCountryCode: '[billingCountryCode]',
shippingCountryCode: '[shippingCountryCode]',
cartId: '[cartId]'
});
</script>
Variable | Description | Formatting |
---|---|---|
'[orderNumber]' | Order ID | i.e. 1000000012 |
'[orderValue]' | Grand Total | formatted 000.00 |
'[orderSubtotal]' | Subtotal | formatted 000.00 |
'[orderItems]' | An array of items ordered (JSON) | '[{sku: 'test-product-sku-1', price: '10.00', qty: '1.00'}]' |
'[currencyCode]' | Currency Code | i.e. USD, GBP etc.. |
'[discountAmount]' | Discount Amount on order | formatted 000.00 |
'[couponCode]' | Coupon code used on order | (blank if no code) |
'[orderSubtotalMinusDiscountWithoutTax]' | Order Subtotal minus the Discount Amount and minus Tax | formatted 000.00 |
'[orderSubtotalMinusDiscountWithTax]' | Order Subtotal minus the Discount Amount plus Tax | formatted 000.00 |
'[shippingAmount]' | Shipping Amount on order | formatted 000.00 |
'[taxAmount]' | Tax Amount on order | formatted 000.00 |
'[customerFirstName]' | The customers first name. | String |
'[customerLastName]' | The customers last name. | String |
'[customerEmail]' | The customers email address. | String |
'[billingCountryCode]' | The country code of the billing address. | String (US, UK, etc) |
'[shippingCountryCode]' | The country code of the shipping address. | String (US, UK, etc) |
'[cartId]' | The ID of the cart that was just converted to an order. | Int |
ShipperHQ variables
ShipperHQ Variables in Email Templates
You can add any of the variables below using the syntax {{var order.VariableName}} in the Order Email Templates. For example to print the delivery date do: {{var order.delivery_date}}
When ShipperHQ is installed the following variables will be available.
- [collectShippingRates]
- [shippingDescription]
- [dispatchDate]
- [deliveryDate] (use: delivery_date for email templates)
- [pickupLocationId]
- [pickupLocation]
- [pickupLatitude]
- [pickupLongitude]
- [pickupDate]
- [pickupEmail]
- [pickupContact]
- [pickupEmailOption]
- [timeSlot]
- [company]
- [city]
- [postcode]
- [region]
- [regionId]
Example Javascript To Loop Through Products In An Order
var $orderedItems = [orderItems];
for(var i =0, len = $orderedItems.length; i<len; i++){
//$orderedItems[i]['sku'];
//$orderedItems[i]['price'];
//$orderedItems[i]['qty']);
}
HTML Variables
Any variables in the Global HTML Variables can be used in this area.
Order Address Variables
Any customer address attribute that has been created can be used as an HTML variable using the format [order.customerBillingAddress.drop_down]
or [order.customerShippingAddress.drop_down]
. ( drop_down is the attribute "Code". )
Any account address attribute that has been created can be used as an HTML variable using the format[order.accountBillingAddress.drop_down]
or [order.accountShippingAddress.drop_down]
.( drop_down is the attribute "Code". )
Updated about 1 year ago