The height adjustment amount for the currently selected attribute value. This value represents the total height impact of this attribute selection, affecting packaging and dimensional calculations.
var totalHeight = Item.Height + attr.HeightAdjustment;
The unique numeric identifier for this attribute. This ID is used internally for database operations and system processing.
var attrId = attr.Id; // 1, 2, 3, etc.
Indicates whether this attribute must be selected before the product can be added to the cart. Required attributes typically represent essential product specifications.
if (attr.IsRequired && !attr.Value) {
error("Please select a " + attr.Prompt);
}
The unique key or name identifier for this attribute. This is used internally to identify the attribute and should be consistent across different product configurations.
var attrKey = attr.Key; // "color", "size", "material", etc.
The length adjustment amount for the currently selected attribute value. This value represents the total length impact of this attribute selection, affecting packaging and dimensional calculations.
var totalLength = Item.Length + attr.LengthAdjustment;
The price adjustment amount for the currently selected attribute value. This value is calculated based on the selected AttributeValue and represents the total price impact of this attribute selection.
var totalPrice = Item.Price + attr.PriceAdjustment;
Indicates whether the price adjustment should be applied as a percentage rather than a fixed amount. When true, the PriceAdjustment value is treated as a percentage of the base price.
if (attr.PriceAdjustmentIsPercentage) {
var adjustment = Item.Price * (attr.PriceAdjustment / 100);
} else {
var adjustment = attr.PriceAdjustment;
}
The display text shown to customers when selecting this attribute. This is the human-readable label that appears in the user interface to describe what this attribute represents.
var prompt = attr.Prompt; // "Select Color", "Choose Size", etc.
The type or category of this attribute. This defines the kind of attribute (e.g., "color", "size", "material") and may affect how the attribute is displayed or processed.
if (attr.Type === "color") {
// Handle color-specific logic
}
The currently selected value for this attribute. This represents the customer's choice for this attribute option. Empty string indicates no selection has been made.
var selectedValue = attr.Value; // "Red", "Large", "Premium", etc.
Array of all possible values available for this attribute. Each value represents a selectable option with its own pricing and adjustment implications.
for (var i = 0; i < attr.Values.length; i++) {
var option = attr.Values[i];
console.log(option.Value + ": $" + option.PriceAdjustment);
}
The weight adjustment amount for the currently selected attribute value. This value represents the total weight impact of this attribute selection, affecting shipping and handling calculations.
var totalWeight = Item.Weight + attr.WeightAdjustment;
The width adjustment amount for the currently selected attribute value. This value represents the total width impact of this attribute selection, affecting packaging and dimensional calculations.
var totalWidth = Item.Width + attr.WidthAdjustment;
Generated using TypeDoc
Represents a product attribute with its configuration and available values. Attributes define the configurable options for a product, such as color, size, material, or any other product variant that affects pricing or specifications.
Each attribute contains a collection of possible values and defines how those values affect the product's pricing, weight, and dimensions.