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.

Hierarchy

  • Attribute

Properties

HeightAdjustment: number

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.

Example

var totalHeight = Item.Height + attr.HeightAdjustment;
Id: number

The unique numeric identifier for this attribute. This ID is used internally for database operations and system processing.

Example

var attrId = attr.Id; // 1, 2, 3, etc.
IsRequired: boolean

Indicates whether this attribute must be selected before the product can be added to the cart. Required attributes typically represent essential product specifications.

Example

if (attr.IsRequired && !attr.Value) {
error("Please select a " + attr.Prompt);
}
Key: string

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.

Example

var attrKey = attr.Key; // "color", "size", "material", etc.
LengthAdjustment: number

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.

Example

var totalLength = Item.Length + attr.LengthAdjustment;
PriceAdjustment: number

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.

Example

var totalPrice = Item.Price + attr.PriceAdjustment;
PriceAdjustmentIsPercentage: boolean

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.

Example

if (attr.PriceAdjustmentIsPercentage) {
var adjustment = Item.Price * (attr.PriceAdjustment / 100);
} else {
var adjustment = attr.PriceAdjustment;
}
Prompt: string

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.

Example

var prompt = attr.Prompt; // "Select Color", "Choose Size", etc.
Type: string

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.

Example

if (attr.Type === "color") {
// Handle color-specific logic
}
Value: string

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.

Example

var selectedValue = attr.Value; // "Red", "Large", "Premium", etc.
Values: AttributeValue[]

Array of all possible values available for this attribute. Each value represents a selectable option with its own pricing and adjustment implications.

Example

for (var i = 0; i < attr.Values.length; i++) {
var option = attr.Values[i];
console.log(option.Value + ": $" + option.PriceAdjustment);
}
WeightAdjustment: number

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.

Example

var totalWeight = Item.Weight + attr.WeightAdjustment;
WidthAdjustment: number

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.

Example

var totalWidth = Item.Width + attr.WidthAdjustment;

Generated using TypeDoc