Array of shopping cart items in the current session. Contains all active shopping cart items for the current customer session. Each item provides full access to product information, attributes, and pricing data.
console("Session has " + Session.CartItems.length + " items");
for (var i = 0; i < Session.CartItems.length; i++) {
var item = Session.CartItems[i];
console("Item: " + item.ProductName + " - $" + item.Price);
}
Array of customer role system names for the current session. Contains all roles assigned to the customer in the current session. Used for role-based pricing and access control.
console("Customer roles: " + Session.CustomerRoles.join(", "));
if (Session.CustomerRoles.includes("VIP")) {
console("VIP customer - apply special pricing");
}
Department name of the customer for the current session. Represents the department or organizational unit the customer belongs to. Used for department-specific pricing and business logic.
console("Customer department: " + Session.Department);
if (Session.Department === "Education") {
console("Educational department - apply academic discount");
}
Cost code of the customer's department for the current session. Empty when the customer has no department, or the department has no cost code set. Used for cost-centre-based session pricing and business logic.
console("Customer department cost code: " + Session.DepartmentCostCode);
if (Session.DepartmentCostCode === "CC-100") {
console("Cost centre CC-100 - apply centre-specific pricing");
}
Value of the discount code currently applied in the session. Reflects the discount coupon code entered by the customer, if any. Used to apply code-specific pricing or promotions at the session level.
if (Session.DiscountCode === "SUMMER20") {
console("Summer discount code applied in session");
}
Customer email address for the current session. Provides access to the customer's email address associated with the session.
console("Session customer email: " + Session.Email);
if (Session.Email.endsWith(".edu")) {
console("Educational customer detected");
}
Alias for CartItems - array of other order items in the session. Provides the same functionality as CartItems for backward compatibility.
var totalSessionValue = 0;
for (var i = 0; i < Session.OtherOrderItems.length; i++) {
totalSessionValue += Session.OtherOrderItems[i].Price * Session.OtherOrderItems[i].Quantity;
}
console("Total session cart value: $" + totalSessionValue);
Get the current value of a checkout attribute for the session customer. The attribute is matched by name, ignoring case. For attributes with predefined values (drop-down, radio buttons, checkboxes) the value names are returned, comma-separated when several are selected. Returns an empty string when the attribute does not exist or has no value.
Name of the checkout attribute
The stored value, or an empty string
var deliveryType = Session.getCheckoutAttributeValue("Delivery Type");
if (deliveryType === "Express") {
console("Express delivery selected - apply surcharge");
}
Set a checkout attribute value for the session customer. The value is saved on the customer and carried into the order, the same as if the customer had entered it at checkout. The attribute is matched by name, ignoring case.
The value must suit the attribute type:
yyyy-MM-dd).. as the decimal separator.If the attribute does not exist or the value is invalid, an error message is reported and nothing is saved. Setting the value it already holds does nothing. The call is ignored while tier prices are being calculated.
Name of the checkout attribute
Value to set
if (Session.CustomerRoles.includes("Wholesale")) {
Session.setCheckoutAttributeValue("Delivery Type", "Pallet");
}
Session.setCheckoutAttributeValue("Required By", "2026-12-24");
Generated using TypeDoc
The session object available in pricing scripts. Represents session-level data and provides access to customer information and shopping cart items that are available during the current session.
This object provides session-wide context for pricing calculations that may need to consider multiple items or customer session data.