CASH-535 - Added null check

This commit is contained in:
Minojhini Valaiyapathi 2025-05-06 14:27:06 -04:00
parent 168a948d04
commit fc459f89cf

View file

@ -791,7 +791,7 @@ export default {
const availablePackageNames = this.$refs.servicePackage?.servicePackageAnswers;
var priceLabel = "";
if (availablePackageNames.length > 1 || availablePackageNames.length == 1) {
if (availablePackageNames?.length > 1 || availablePackageNames?.length == 1) {
var tier = availablePackageNames[0];
if (tier) {
let lineItemsToPrice = this.availableLineItems;
@ -820,8 +820,8 @@ export default {
priceLabel = price.toFixed(2);
}
}
const subTotalLabel = this.Variables.CASH_SUBTOTAL;
this.pushVariableToDataLayer({ [subTotalLabel]: priceLabel });
const subTotalLabel = this.Variables?.CASH_SUBTOTAL;
this.pushVariableToDataLayer?.({ [subTotalLabel]: priceLabel });
});
},
async skip(insuranceSelection, packageSelection) {