scandipwa/gtm-fe

TypeError: Cannot destructure property 'selectedShippingMethodCode' of 'instance.state' as it is null.

Opened this issue · 2 comments

Problem
The destructuring doesn't have fallback values and uses a nested source, this causes JavaScript to throw an error because the value is null.

Solution
Apply fallback values and started without a nested source variable.

Error
TypeError: Cannot destructure property 'selectedShippingMethodCode' of 'instance.state' as it is null.

I have applied the necessary changes to prevent this function from throwing errors.

#4

Pull request with solution #4

Can someone please check this? We'd like to use the GTM implementation but keeping running into this bug.