diff --git a/src/helpers/cart-helper.js b/src/helpers/cart-helper.js index 1920df3c..22b0dcdb 100644 --- a/src/helpers/cart-helper.js +++ b/src/helpers/cart-helper.js @@ -165,8 +165,9 @@ export function getCartTotal(order) { export function getRecalibrationTotal(order) { const itemsWithRecalibration = getServiceLineItems(order) .filter((item) => item.requiresRecalibration); - const recalibrationLineItems = itemsWithRecalibration.map((item) => { - return item.childParts?.find((child) => child.partType === partTypeStrings.RECALIBRATION || child.partType === partTypeStrings.ADAS_RECALIBRATION) ?? {}; + + const recalibrationLineItems = itemsWithRecalibration.flatMap((item) => { + return item.childParts?.filter((child) => child.partType === partTypeStrings.RECALIBRATION || child.partType === partTypeStrings.ADAS_RECALIBRATION) ?? []; }); return getPriceOfLineItems(recalibrationLineItems); diff --git a/src/store/index.js b/src/store/index.js index ca323c1c..955c7283 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1133,7 +1133,6 @@ export const useMainStore = defineStore({ if (glassPart) { for (const recalPartInformation of recalPartArray) { const recalChildPart = glassPart.childParts?.find((cp) => cp.partNumber === recalPartInformation.partNumber); - console.log('Existing recalibration child part found', recalChildPart); if (!recalChildPart) { if (!Array.isArray(glassPart.childParts) || !glassPart.childParts.length) { glassPart.childParts = [];