Google map is not working with cache plugin

This topic has 9 replies, 4 voices, and was last updated 2 minutes ago ago by Tony Rodriguez

  • Avatar: Atip
    Atip
    Participant
    December 1, 2025 at 22:58

    I have added Google map block by Xstore using Elementor. it works only on first visit of the page, when you revisit the page you get the error:

    Uncaught TypeError: Cannot read properties of undefined (reading 'DEFAULT')
        at initMap (google-map.js:29:71)
        at GoogleMap (google-map.js:174:9)
        at _runHook (frontend.min.js:2:15266)
        at Object.doAction (frontend.min.js:2:15868)
        at Object.runReadyTrigger (frontend.min.js:2:20034)
        at frontend-modules.min.js:2:17704

    I am using LItespeed cache plugin. I’ve tried to add ‘google-map.js’ to excludes.
    I’ve tired W3total Cache (recommended by you).
    It only works if I disable caching plugin.

    Content is visible for topic creator and
    support staff only.
    8 Answers
    Avatar: Samir Malik
    Samir Malik
    Support staff
    December 2, 2025 at 04:05

    Dear Atip,

    We have checked your contact page and confirmed that the Google Map is functioning properly without any issues.

    However, you may exclude the Google Maps scripts from the LiteSpeed Cache settings by following these steps:

    1. Go to WordPress Dashboard → LiteSpeed Cache → Page Optimization → JS Settings.
    2. Locate the “JS Excludes” section and add the following:
    google-map.js
    3. If you prefer to specify the path more precisely, you can use:
    /path/to/google-map.js

    Additional Google Scripts to Consider Excluding:

    
    maps.googleapis.com  
    google-analytics.com/analytics.js 
    googletagmanager.com/gtag/js  
    recaptcha/api.js
    

    Reason for Excluding These Scripts:
    Google Maps and similar external scripts often need to load dynamically and should not be combined, minified, or deferred excessively because:
    – They load additional resources dynamically.
    – They have specific timing requirements.
    – They may malfunction if combined with other scripts.
    – They are already optimized and served from Google’s CDN.

    Alternative: Exclude by URL Pattern
    In the JS Excludes field, you can also use patterns such as:

    
    googleapis.com  
    gstatic.com
    

    This will exclude all scripts from these domains.

    After making these changes, please remember to purge your LiteSpeed cache to apply the updates immediately.

    Best regards,
    8Theme’s Team

    Avatar: Atip
    Atip
    Participant
    December 2, 2025 at 07:26

    Hi! Thanks for your reply. No it doesn’t work. It works on Contacts page because I’m using there a standard google map block provided by Elementor. Block provided by Xstore doesn’t work.

    As you can see on screenshots all those file have been added to excludes in Litespeed.

    Please check the attached link:
    -scroll to the bottom of the page

    -you will see contact form there, and there should be a map under phone numbers

    -if you can see the map, close the tab and open it again (or duplicate) on the second visit you will discover an error.

    Content is visible for topic creator and
    support staff only.
    Files is visible for topic creator and
    support staff only.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    December 2, 2025 at 09:45

    Hello @Atip,

    Please clear your cache in the caching plugin and check again. We have made some improvements to the Google Map widget scripts.

    Best regards,
    Jack Richardson
    The 8Theme Team

    Avatar: Atip
    Atip
    Participant
    December 3, 2025 at 22:27

    The error still occurs on this page froom time to time. reload the page several times and you will see.

    Content is visible for topic creator and
    support staff only.
    Files is visible for topic creator and
    support staff only.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    December 4, 2025 at 08:20

    Hello @Atip,

    Could you please perform a test using a different browser or clear the cache in your current browser? We have previously conducted tests, and after additional testing, we did not encounter any issues with Google Maps (a video is attached in the private content).

    If you still experience any issues, please describe which browsers and devices you used for your tests.

    Best regards,
    Jack Richardson
    8Theme Team

    Content is visible for topic creator and
    support staff only.
    Avatar: Atip
    Atip
    Participant
    December 4, 2025 at 16:27

    It looks like you are right and now everything works perfectly. Thank you!

    Avatar: Atip
    Atip
    Participant
    December 4, 2025 at 16:29

    Thanks for the support! My topic “Google map is not working with cache plugin” has been successfully resolved.

    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    December 4, 2025 at 16:29

    Dear Atip,

    Thanks for being part of our WordPress & WooCommerce community!

    We’re happy we could assist you. Your feedback truly matters — it helps us make XStore better, faster, and more reliable with every release.

    Together, we’re shaping a better WooCommerce experience for everyone.

    Topic closed.
    The 8Theme Team

  • Viewing 9 results - 1 through 9 (of 9 total)

The issue related to '‘Google map is not working with cache plugin’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.