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