The actual SKU based on the current attribute combination. If no attributes are selected, this will be the same as the product SKU. This value reflects the specific configuration of the product being priced.
// Log the configured SKU for debugging
debug("Base SKU: " + Item.Sku);
debug("Configured SKU: " + Item.ActualSku);
if (Item.ActualSku !== Item.Sku) {
debug("Product has attribute variations");
}
Additional shipping charge for this specific product variant. This value is added to the base shipping cost and represents any extra shipping fees specific to this item.
var totalShipping = baseShippingCost + Item.AdditionalShippingCharge;
Array of attributes with Key, Value, IsRequired, Prompt, PriceAdjustment, etc.
// Loop through all attributes and apply price adjustments
var totalAdjustment = 0;
for (var i = 0; i < Item.Attributes.length; i++) {
var attr = Item.Attributes[i];
debug("Attribute: " + attr.Key + " = " + attr.Value);
totalAdjustment += attr.PriceAdjustment || 0;
}
return Item.Price + totalAdjustment;
Array of batch tiers (same as PricingTiers but for batch tier table)
if (Item.IsBatch && Item.BatchTiers.length > 0) {
var batchTier = HelperMethods.FindTier(Item.NumberOfRecords, Item.BatchTiers);
if (batchTier) {
debug("Batch tier price: $" + batchTier.Price);
}
}
Indicates whether the weight can be set or modified for this item. Some products may have fixed weights that cannot be changed, while others allow weight adjustments based on attributes or custom settings.
if (Item.CanSetWeight && Item.Weight > 5000) {
debug("Heavy item detected - weight: " + Item.Weight + "g");
// Apply heavy item surcharge
return Item.Price + 10.00;
}
Index of this item in the other order item array (-1 if not in array)
if (Item.CartItemIndex >= 0) {
debug("This is cart item #" + (Item.CartItemIndex + 1));
}
Alias of OtherOrderItems
// Apply cart-wide discount if total exceeds threshold
var cartTotal = 0;
for (var i = 0; i < Item.CartItems.length; i++) {
cartTotal += Item.CartItems[i].Price * Item.CartItems[i].Quantity;
}
if (cartTotal > 500) {
debug("Cart total $" + cartTotal + " - applying 10% discount");
return Item.Price * 0.90;
}
Array of category names that this product belongs to. Categories are used for product organization, filtering, and category-specific pricing rules.
if (Item.Categories.includes("Premium")) {
return Item.Price * 1.1; // 10% premium markup
}
Array of customer role system names
// Check for wholesale pricing
if (Item.CustomerRoles.indexOf("Wholesale") >= 0) {
debug("Wholesale customer detected");
return Item.Price * 0.70; // 30% wholesale discount
} else if (Item.CustomerRoles.indexOf("VIP") >= 0) {
return Item.Price * 0.90; // 10% VIP discount
}
Department name of user
// Apply department-specific pricing
if (Item.Department === "Marketing") {
debug("Marketing department order");
return Item.Price * 0.80; // 20% marketing discount
} else if (Item.Department === "Sales") {
return Item.Price * 0.75; // 25% sales discount
}
Value of the currently used discount code
// Apply special discount for specific codes
if (Item.DiscountCode === "SUMMER20") {
debug("Summer sale discount applied");
return Item.Price * 0.80; // 20% off
} else if (Item.DiscountCode === "VIP50") {
return Item.Price * 0.50; // 50% off
}
User email
// Apply corporate discount for company emails
if (Item.Email.endsWith("@mycompany.com")) {
debug("Corporate customer: " + Item.Email);
return Item.Price * 0.85; // 15% corporate discount
}
The final calculated price for this item, including all discounts and adjustments. If the pricing script is attached to a product, this will be the product variant price multiplied by the quantity. If the pricing script is attached to a checkout attribute, it represents the total price for the entire quantity of this item after all pricing rules have been applied.
var finalTotal = Item.FinalPrice;
console("Final price for " + Item.Quantity + " units: $" + finalTotal);
The height of the item in the configured dimension unit (typically inches or centimeters). This value is used for packaging calculations and dimensional pricing.
// Check if item is oversized
if (Item.Height > 48) {
debug("Oversized item - adding handling fee");
return Item.Price + 25.00;
}
Whether this is a batch job
if (Item.IsBatch) {
debug("Processing batch job with " + Item.NumberOfRecords + " records");
var batchSetupFee = 25.00;
return Item.Price + batchSetupFee;
}
Whether this item is in the other order item array
if (Item.IsInOtherOrderItems) {
debug("Item is part of multi-item order");
// Consider other items for bundle pricing
}
Whether this is a version of a job
if (Item.IsVersion) {
debug("This item is a version of an existing job");
// Use version-specific pricing logic
}
The length of the item in the configured dimension unit (typically inches or centimeters). This value is used for packaging calculations and dimensional pricing.
// Calculate volume for shipping
var volume = Item.Width * Item.Height * Item.Length;
var volumetricWeight = volume / 5000; // Standard divisor
debug("Volumetric weight: " + volumetricWeight);
Number of pages (-1 if not valid)
if (Item.NumberOfPages > 0) {
var perPageCost = 0.10;
var pageCost = Item.NumberOfPages * perPageCost;
debug("Document has " + Item.NumberOfPages + " pages, adding $" + pageCost);
return Item.Price + pageCost;
}
Number of records (-1 if not valid)
if (Item.NumberOfRecords > 0) {
var perRecordCost = 0.05;
var recordCost = Item.NumberOfRecords * perRecordCost;
debug("Batch has " + Item.NumberOfRecords + " records");
return Item.Price + recordCost;
}
Number of versions
if (Item.NumberOfVersions > 1) {
debug("Multi-version job with " + Item.NumberOfVersions + " versions");
// Apply version discount
return Item.Price * 0.95; // 5% multi-version discount
}
The old price from the product variant, typically used for displaying price comparisons or discounts. This value represents the previous price before any recent price changes.
if (Item.OldPrice > Item.Price) {
var discount = Item.OldPrice - Item.Price;
return "Save $" + discount.toFixed(2);
}
Index of this item in the other order item array (0 if not in array)
// Apply setup fee only to first item
if (Item.OrderItemIndex === 0) {
debug("First item - adding setup fee");
return Item.Price + 15.00;
}
Array of other order items using the same custom pricing script
// Calculate total quantity across all cart items for volume discount
var totalQty = Item.Quantity;
for (var i = 0; i < Item.OtherOrderItems.length; i++) {
totalQty += Item.OtherOrderItems[i].Quantity;
}
debug("Total quantity in cart: " + totalQty);
The pack quantity, calculated as the order quantity divided by the product variant's OrderPackQuantity. This represents how many packs are being ordered.
var packPrice = Item.Price * Item.PackQuantity;
The standard product variant price in the base currency. This is the base price before any attribute adjustments, tier pricing, or special pricing is applied.
var basePrice = Item.Price;
var adjustedPrice = basePrice * 1.2; // 20% markup
Price per record (-1 if not valid)
if (Item.PricePerRecord > 0 && Item.NumberOfRecords > 0) {
var recordTotal = Item.PricePerRecord * Item.NumberOfRecords;
debug("Record pricing: " + Item.NumberOfRecords + " x $" + Item.PricePerRecord);
return recordTotal;
}
Array of pricing tiers with Price, Quantity, and CustomerRole
// Find the best tier for the current quantity
var tier = HelperMethods.FindTier(Item.Quantity, Item.PricingTiers, Item.CustomerRoles);
if (tier) {
debug("Using tier: " + tier.Quantity + " @ $" + tier.Price);
return tier.Price * Item.Quantity;
}
The product cost, representing the actual cost to produce or acquire the product. This value is used for margin calculations and profit analysis.
var margin = Item.Price - Item.ProductCost;
var marginPercentage = (margin / Item.Price) * 100;
The name of the product as displayed to customers. This is the human-readable product name used in the user interface and order confirmations.
debug("Processing order for: " + Item.ProductName);
// Check for special product names
if (Item.ProductName.indexOf("Rush") >= 0) {
debug("Rush order product detected");
return Item.Price * 1.50; // 50% rush fee
}
The order quantity for this item. This represents how many units of this product variant are being ordered. Used for quantity-based pricing and tier calculations.
var tier = HelperMethods.FindTier(Item.Quantity, Item.PricingTiers);
The quantity selector mode for this product. This determines how quantity selection is handled in the user interface and affects pricing calculations.
switch (Item.QuantitySelectorMode) {
case 1: // Individual units
return Item.Price * Item.Quantity;
case 2: // Packs
return Item.Price * Item.PackQuantity;
}
The Stock Keeping Unit (SKU) of the product variant. This is the unique identifier for the product variant and is used for inventory management and order processing.
// Apply SKU-specific pricing rules
if (Item.Sku.startsWith("PREMIUM-")) {
debug("Premium product: " + Item.Sku);
return Item.Price * 1.10; // 10% premium markup
}
The special price for the product variant, if applicable. This value is null if no special pricing is currently active. Special pricing typically overrides the standard price for promotional periods.
var finalPrice = Item.SpecialPrice || Item.Price;
The end date for special pricing, if applicable. This value is null if no special pricing is currently active. Used to determine if special pricing should be applied based on current date.
var now = new Date();
if (Item.SpecialPriceEndDate && now <= Item.SpecialPriceEndDate) {
return Item.SpecialPrice;
}
The start date for special pricing, if applicable. This value is null if no special pricing is currently active. Used to determine if special pricing should be applied based on current date.
var now = new Date();
if (Item.SpecialPriceStartDate && now >= Item.SpecialPriceStartDate) {
return Item.SpecialPrice;
}
Array of tag names associated with this product. Tags are used for product classification, search optimization, and tag-based pricing rules.
if (Item.Tags.includes("Featured")) {
return Item.Price * 1.05; // 5% featured product markup
}
The calculated unit price for this item. If the pricing script is attached to a product, this will be the product variant price. If the pricing script is attached to a checkout attribute, this will be the price per individual unit including discounts and all the adjustments.
var unitPrice = Item.UnitPrice;
var totalForQuantity = unitPrice * Item.Quantity;
Array of versions with JobId, CustomName, and Quantity
// Calculate pricing across all versions
if (Item.Versions.length > 0) {
debug("Job has " + Item.Versions.length + " versions");
for (var i = 0; i < Item.Versions.length; i++) {
var ver = Item.Versions[i];
debug("Version: " + ver.CustomName + ", Qty: " + ver.Quantity);
}
}
Sum of all quantities of all versions
// Use total version quantity for tier pricing
if (Item.VersionsSumQuantity > 0) {
var tier = HelperMethods.FindTier(Item.VersionsSumQuantity, Item.PricingTiers);
if (tier) {
debug("Using combined version quantity: " + Item.VersionsSumQuantity);
return tier.Price;
}
}
The weight of the item in the configured weight unit (typically grams or ounces). This value is used for shipping calculations and weight-based pricing.
// Calculate shipping cost based on weight
var weightInKg = Item.Weight / 1000;
var shippingRate = 2.50; // $2.50 per kg
var shippingCost = weightInKg * shippingRate;
debug("Item weight: " + Item.Weight + "g, Shipping: $" + shippingCost);
The width of the item in the configured dimension unit (typically inches or centimeters). This value is used for packaging calculations and dimensional pricing.
// Calculate area-based pricing
var area = Item.Width * Item.Height;
var pricePerSquareUnit = 0.05;
var areaCost = area * pricePerSquareUnit;
debug("Area: " + area + " sq units, Cost: $" + areaCost);
Get file information for a specific configurable file from Global Data
Name of the file
FileInfo object
// Method 1: Using getGlobalFileContent (current approach)
var fileInfo = Item.getGlobalFileContent("test.csv");
if (fileInfo && fileInfo.CsvContent) {
console("CSV file loaded successfully with " + fileInfo.CsvContent.length + " rows");
var headers = fileInfo.CsvContent[0]; // First row contains headers
// Process CSV data from FileInfo object
for (var i = 1; i < fileInfo.CsvContent.length; i++) {
var row = fileInfo.CsvContent[i];
// Access data by column index
var firstColumn = row[0];
var secondColumn = row[1];
}
}
// For non-CSV files, access raw content
var textFile = Item.getGlobalFileContent("config.txt");
if (textFile && textFile.Content) {
console("File content: " + textFile.Content);
}
Get CSV file content as a 2D array from Global Data
Name of the CSV file
2D array representing CSV content, or null if file doesn't exist
// Basic CSV loading and processing
var csvData = Item.getGlobalFileCsvContent("test.csv");
if (csvData) {
console("CSV data loaded directly as array with " + csvData.length + " rows");
// Extract column names from first row
function getColumnNames(csvTable) {
if (csvTable && csvTable.length > 0) {
return csvTable[0]; // Returns array of column names
}
return [];
}
var columnNames = getColumnNames(csvData);
console("Available columns: " + columnNames.join(", "));
// Process data rows (skip header row)
for (var i = 1; i < csvData.length; i++) {
var row = csvData[i];
// Access data by column index
var firstColumn = row[0];
var secondColumn = row[1];
}
} else {
console("CSV file not found or empty");
}
// Method 2: Using getGlobalFileCsvContent (preferred for CSV files)
var csvData = Item.getGlobalFileCsvContent("test.csv");
if (csvData) {
console("Direct CSV access with " + csvData.length + " rows");
// csvData is already a 2D array, no need to access .CsvContent property
}
Generated using TypeDoc
The main item object available in pricing scripts. Represents the product variant being priced and provides access to all product information, attributes, pricing data, and methods for file handling and attribute management.
This object is the primary interface for accessing product data and performing pricing calculations in pricing scripts.