Cannot read `push`of undefined

Hello,

sorry, I am unfortunately not a programmer, but get stuck on a contact form, that does not work properly.

I have an address form on a website. After entering the address data, the information does not get forwarded. The next page doesn’t get called / loaded.

According to Chrome DevTools, there is an error.

Screenshot:

DevTools error message: Uncaught TypeError: Can not read property push of undefined

P.S. Someone told me that I need to add the following code above line 49 of checkout.js:
window.dataLayer = window.dataLayer || [];

Would that solve the problem?

possibly, it’s telling you that that you cant push value dlUpdate into the array because it is currently undefined and it’s not executing the rest of the code once it reaches line 49.

did you try adding?

window.dataLayer = window.dataLayer || [];
1 Like

No, I haven’t tried adding

window.dataLayer = window.dataLayer || [];

cause I have no access to FTP.

Adding the code above is not very nice.
Just in case addind the code doesn’t solve the problem, what could be another cause/reason/soursce of the problem, that the address information in the contact form does not get forwarded to the next page?

Thank you so much!

Just add the code, then tell us the outcome.

@Heyrio is right, you have to add the property before you can push anything unto it.

it’s hard to tell without seeing the rest of the code