'Cannot read properties of undefined (reading 'reduce')' error when 'Add to cart' is clicked

'Cannot read properties of undefined (reading 'reduce')' error when 'Add to cart' is clicked

Avipsha
Visitor
2 0 0

Hello!

 

When customers click the 'Add to cart' button on our website, there is an error 'Cannot read properties of undefined (reading 'reduce')' on Chrome browser and 'undefined is not an object (evaluating 'window.theme.cart.store.getState')' error on Safari browser. The button works fine on mobile phone and incognito. We haven't made any changes in the code recently. We use the Venue theme. Why is this happening? How can we fix this?

 

Thanks in advance.

Reply 1 (1)

EcomGraduates
Shopify Partner
840 71 121

 

  • JavaScript Error: The error indicates that some JavaScript code is trying to access or manipulate data that is undefined or unavailable at that moment. The reduce() function in JavaScript is typically used on arrays, and if it's being called on an undefined object, it will throw this error.

  • Cache or Session Storage Issue: Since the issue does not occur in incognito mode or on mobile, it could be related to cached data or session storage in the browser. JavaScript might be trying to retrieve cart information from local storage, and if that data is undefined, it causes the error.

 

    • Since the issue works in incognito and on mobile, clearing your browser’s cache and cookies might resolve the problem for regular browsing sessions.
    • Have customers also clear their cache if they report this issue.
    • If your Venue theme has recently updated automatically, revert to the previous version to check if the error disappear

 

 


 If this fixed your issue, likes and accepting as a solution are highly appreciated
|  Build an online presence with our custom-built Shopify Theme: EcomifyTheme
|  Check out our reviews: Trustpilot Reviews
|  We are Shopify Partners: EcomGraduates Shopify Partner