Use the parts list for calculating prices
Calculate a price based on the current part list
// fake implementation of a database
// only for showcase purpose
const priceDataBase = {};
configurator.ui.callbacks.onPartListUpdate = (partList) => {
const parts = partList.fullList;
let priceSum = parts.reduce((sum, part) => {
if (!priceDataBase[part.articleNr]) {
priceDataBase[part.articleNr] = Math.random() * 10;
}
return sum += priceDataBase[part.articleNr];
}, 0);
const shippingCosts = 30;
// Tell the Roomle Configurator to show the current price
configurator.ui.setPrice('€', priceSum + shippingCosts);
};Notes about onPartListUpdate
Typical challenges with the part list


Last updated