Home / Forums / WoodMart support forum / Recurring JavaScript error on our WooCommerce store
Home › Forums › WoodMart support forum › Recurring JavaScript error on our WooCommerce store
Recurring JavaScript error on our WooCommerce store
- This topic has 5 replies, 2 voices, and was last updated 2 months ago by
Artem Temos.
-
AuthorPosts
-
April 30, 2026 at 11:44 am #717282
tarmovalingParticipantHi,
We are experiencing a recurring JavaScript error on our WooCommerce store that has been captured in 180+ real user sessions via LogRocket.
Error:
TypeError: Cannot read properties of undefined (reading ‘close’)File:
/wp-content/themes/woodmart/js/scripts/wc/actionAfterAddToCartThis error occurs during the add-to-cart process. In affected sessions, the flow is:
User clicks Add to Cart
Woodmart AJAX add-to-cart is triggered
Then the error is thrown from actionAfterAddToCart
After that, the UI becomes unstableObserved user impact:
Add-to-cart spinner sometimes keeps loading
Cart popup / mini-cart behaves inconsistently or does not close properly
In some cases, the page appears frozen until refreshImportant:
This is not a theoretical issue — it is consistently visible in real user session recordings (LogRocket), even if it may not always be reproducible in a clean manual test.Also present in the same sessions:
TypeError: Cannot read properties of undefined (reading ‘forEach’)
File:
/wp-content/plugins/sitepress-multilingual-cms/dist/js/ajaxNavigation/app.jsThis suggests a possible conflict between:
Woodmart add-to-cart / mini-cart popup logic
WPML AJAX navigation
WooCommerce AJAX cart updatesAdditional observation:
In some sessions, an unexpected Estonian free-shipping message appears inside the cart popup on the English site:“Lisage [ülejäänud] ostukorvi ja saate tasuta kohaletoimetamise!”
This indicates that the cart popup DOM may be dynamically modified (possibly via WPML or custom logic), which could be related to the error if expected elements are missing when actionAfterAddToCart runs.
Environment:
Theme: WoodMart (latest version)
Plugins: WooCommerce, WPML, WooCommerce Multilingual
Issue type: intermittent but frequent (180+ sessions)Questions:
Under what conditions can actionAfterAddToCart call .close() on an undefined object?
Could the cart popup instance be missing or replaced due to AJAX updates (e.g. WPML navigation or cart fragments)?
Are there known compatibility issues between Woodmart cart popup scripts and WPML AJAX navigation?We can provide LogRocket session recordings and screenshots if needed.
Thanks
April 30, 2026 at 12:02 pm #717284Hi, thanks for the detailed report and the error messages.
To investigate properly, we need exact steps to reproduce the problem on your site. Please provide a precise, click-by-click path we can follow. Without that, it’s impossible to determine what went wrong in those sessions.
Kind Regards
April 30, 2026 at 12:27 pm #717285
tarmovalingParticipantHi,
Thanks for your reply.
The issue is intermittent and does not happen on every attempt, which is why it is difficult to reproduce consistently with a clean test.
However, based on LogRocket recordings, the typical flow where the error occurs is:
1. Open any product category (e.g. Food supplements)
2. Open a product page
3. Click “Add to cart”
4. Open the mini-cart / cart popup
5. Continue browsing or adding more productsAt some point during these actions, the following happens:
– The add-to-cart spinner does not stop
– The cart popup behaves inconsistently or does not close
– The page appears frozen for a few secondsAt the same moment, the JS error is triggered:
Cannot read properties of undefined (reading ‘close’)Important:
This does not happen on every attempt, but it is consistently captured across many real user sessions (180+), which indicates a timing or AJAX-related issue rather than a simple static bug.We also see repeated WPML-related errors (“reading ‘forEach’”) in the same sessions, which may suggest that DOM elements used by the cart popup are being replaced or not yet available when Woodmart’s script runs.
If helpful, I can provide:
– LogRocket session recordings (showing the exact moment the error occurs)
– Screenshots of the error in contextPlease let me know if you would like access to those recordings.
Thanks
Attachments:
You must be logged in to view attached files.April 30, 2026 at 1:13 pm #717289Hi, and thank you for the thorough report and for offering to share recordings.
We won’t be able to diagnose or fix this without a way to reproduce it on our side. Session recordings are helpful for context, but we still need a precise sequence that triggers the issue reliably in a clean environment. The intermittent nature you’re seeing may happen only for some customers and can be caused by their browser extensions or connectivity conditions.
Kind Regards
April 30, 2026 at 1:19 pm #717290
tarmovalingParticipantThanks for your reply.
I understand that a clean reproduction is ideal, but in this case the issue is consistently visible in real user sessions (180+), and always originates from the same Woodmart file:
/wp-content/themes/woodmart/js/scripts/wc/actionAfterAddToCart
This strongly suggests a timing-related issue rather than a user-specific environment problem.
Based on the session recordings, the most typical flow where the error appears is:
1. User opens a product page
2. Clicks “Add to cart”
3. Immediately continues interacting (e.g. navigates, scrolls, opens another product/category)
4. During this process, the AJAX add-to-cart completes
5. Then actionAfterAddToCart runs and attempts to call .close() on an undefined popup objectResult:
• Cart popup is not properly initialized or already removed
• JS error is thrown
• UI becomes unstable (spinner stuck, popup not closing, occasional freeze)This seems like a race condition between:
• Woodmart’s cart popup initialization
• AJAX updates (possibly WooCommerce fragments or WPML navigation)Here is one example session where this clearly happens:
[insert LogRocket link]Even if this cannot be reproduced 100% consistently in a clean environment, the error is happening frequently for real users and affects the add-to-cart experience.
Could you please check under what conditions the cart popup instance may be undefined when actionAfterAddToCart is triggered?
Thanks in advance.
April 30, 2026 at 2:03 pm #717291Hello,
This error may occur only if there is no magnigic popup JS library loaded on the page. It is not related to the add to cart or AJAX. As a workaround, you may try to enable this library to be always loaded on your website in Theme Settings -> Performance -> JS.
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register