CheckoutItem: CheckoutItem

Global CheckoutItem object available in checkout pricing scripts. This constant provides access to comprehensive checkout information, allowing scripts to access customer details, shipping information, and all items being processed during checkout.

The CheckoutItem object is essential for checkout-specific pricing scripts that need to:

  • Calculate shipping costs based on destination
  • Apply geographic-based pricing or taxes
  • Consider multiple items for checkout-level discounts
  • Access customer information for personalized pricing
  • Implement address-based business logic

Example

// Geographic-based pricing
if (CheckoutItem.Address && CheckoutItem.Address.Country.TwoLetterIsoCode === "CA") {
console("Canadian shipping - apply CAD pricing");
}

// Multi-item checkout discounts
if (CheckoutItem.Items.length >= 3) {
console("Multi-item checkout - apply bundle discount");
}

// Customer role-based checkout pricing
if (CheckoutItem.Customer.Roles.includes("Premium")) {
console("Premium customer checkout - free shipping");
}

// Business address detection
if (CheckoutItem.Address.Company) {
console("Business checkout - apply B2B pricing");
}

// Express checkout handling
if (CheckoutItem.Mode === "express") {
console("Express checkout - add expedited processing fee");
}

// State-specific tax calculation
if (CheckoutItem.StateProvince && CheckoutItem.StateProvince.Abbreviation === "NY") {
console("New York delivery - apply NY state tax");
}

Generated using TypeDoc