// Check if customer has multiple items for volume pricing
if (Session.CartItems.length > 1) {
console("Multiple items in cart - check for volume discounts");
var cartTotal = 0;
for (var i = 0; i < Session.CartItems.length; i++) {
cartTotal += Session.CartItems[i].Price * Session.CartItems[i].Quantity;
}
if (cartTotal > 500) {
console("Cart total over $500 - apply volume discount");
}
}
// Apply role-based session pricing
if (Session.CustomerRoles.includes("Wholesale")) {
console("Wholesale customer session - apply wholesale pricing");
}
// Department-specific session logic
if (Session.Department === "Marketing") {
console("Marketing department session - apply marketing discounts");
}
// Customer email-based logic
if (Session.Email.includes("@company.com")) {
console("Internal company customer - apply employee pricing");
}
Generated using TypeDoc
Global Session object available in pricing scripts. This constant provides access to session-level data and functionality, allowing scripts to access customer session information and shopping cart data across the entire session context.
The Session object is particularly useful for pricing scripts that need to: