diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 1c0922ba0..a3dc363f5 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -20,7 +20,6 @@ export async function loadSessionIfPresent(isConceptInsurance, pageNameToLog) { // Do nothing if there is no cookie or session to use for loading. if ( funnelCookie == null || - funnelCookie.SavedSessionId == null || funnelCookie.ReferralCorrelationId == null || !funnelCookie.ReferralNumber ) { @@ -128,7 +127,7 @@ async function loadSession( const response = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.LOAD_SESSION, { - savedSessionId: savedSessionId?.toString(), + savedSessionId: savedSessionId != null ? savedSessionId.toString() : null, referralNumber, referralDate, referralCorrelationId, diff --git a/src/router/methods/helpers/consume-referral-info.js b/src/router/methods/helpers/consume-referral-info.js index 6393eedc7..c28ed7669 100644 --- a/src/router/methods/helpers/consume-referral-info.js +++ b/src/router/methods/helpers/consume-referral-info.js @@ -15,11 +15,14 @@ export async function consumeReferralQuerystrings() { // If no referral number in querystring, check if heritage funnel updated last. // This would indicate a customer that went to heritage but did not return through the // normal route. ie: left the site in search of a discount and returned without querystrings. + + //or if a referral number is in query string check if heritage funnel updated last + // This would indicate a customer that returned through normal route like from sfa email const didHeritageFunnelUpdateLast = getFunnelCookie()?.DidHeritageFunnelUpdateLast; - if (didHeritageFunnelUpdateLast && !referralNumber) { - referralNumber = getFunnelCookie().ReferralNumber; - parentAccount = getFunnelCookie().ReferralParentAccountNumber; - correlationId = getFunnelCookie().ReferralCorrelationId; + if (didHeritageFunnelUpdateLast) { + referralNumber = referralNumber ?? getFunnelCookie().ReferralNumber; + parentAccount = parentAccount ?? getFunnelCookie().ReferralParentAccountNumber; + correlationId = correlationId ?? getFunnelCookie().ReferralCorrelationId; referralDate = getFunnelCookie().ReferralDate; savedSessionId = getFunnelCookie().SavedSessionId; }