Interface: ModularPrices
Maps product instance IDs to their complete pricing information.
The ModularPrices interface provides a structure for tracking and accessing price information for each component in a modular product configuration. Each key is a unique instance ID, and each value contains complete pricing details for that specific component.
This structure is essential for modular products where the total price is the sum of multiple independently configured components, each with its own pricing rules, quantity breaks, and options.
Example
// Accessing and summarizing prices of components in a modular office setup
const officeSetup = {
modularPrices: {
"desk-instance-123": {
price: 750,
currency: "USD",
unitPrice: 750,
levels: [/* price levels */]
},
"chair-instance-456": {
price: 350,
currency: "USD",
unitPrice: 350,
levels: [/* price levels */]
},
"storage-instance-789": {
price: 420,
currency: "USD",
unitPrice: 420,
levels: [/* price levels */]
}
}
};
// Calculate total price of the modular configuration
const totalPrice = Object.values(officeSetup.modularPrices)
.reduce((sum, item) => sum + item.price, 0);
console.log(`Total office setup: $${totalPrice}`); // "Total office setup: $1520"
Indexable
[key
: string
]: PriceData
Maps product instance IDs to their pricing information.
Each key is a unique instance ID for a component in the modular configuration, and each value contains the complete pricing details for that component.