Get ride of google maps from PrestaShop

Sometimes some of you might encounter issues with PrestaShop, which loads google maps even that you don’t want to (disabled this option in back-office, even deleted the API key). In order to apre your time I must state from now that my problem which I will detail bellow was caused by an module, NOT by PrestaShop itself. So, if you done everything on back-office and still see on developer tab (page inspector) some warings saying: “NoApiKeys” and/or “SensorNotRequired” so… keep reading.

I decided not to use this feature of PrestaShop, to display an Google map with store location. For that specific project was useless – my customer didn’t want it.
Moreover, the problem is that on page speed test I was advised to get ride from some javascripts wich increase loading time, and this Google Maps JS Api was one of the suggestions.

On picture bellow, you can see that one tool for page analysis (I think was Lighthouse from Chrome) reccomended me to reduce some Javascript in order to incease page loading speed (see …api/js?sensor=true):

PrestaShop suggestion to improve page loading speed

Looking on page source I saw:

<script type=”text/javascript” src=””></script>

1. I went to Modules / Block: Store locator and disable it.
Checking the page with Inspector / Developer Tools, I have seen 2 nasty messages:

Google Maps JavaScript API warning: NoApiKeys /maps/documentation/javascript/error-messages#no-api-keys

Google Maps JavaScript API warning: SensorNotRequired /maps/documentation/javascript/error-messages#sensor-not-required

Inspector showing NoApiKeys and SensorNotRequired, PrestaShop

It seems that disabling that module still will make google maps js scripts loading…

2. I have deleted the API Key from PrestaShop back-office, Preferences / General
Damn, no luck ! The warnings were still there.

Doing some research on internet, found another guy who struggled with this issue: questions/52551656/remove-google-maps-completely-from-prestashop-1-6
I was thinking to use an hard approach, messing with PS_STORES_SIMPLIFIED directly in database, table ps_configuration (I mean to change value to 1 or zero, to test whats happening). But it came the ideea to write an article about this problem in PrestaShop and thinking forward, maybe not all of my readers know/like/have possibility to mess with database, and I decided to try the simple way, by looking on PrestaShop back-office.

3. So, I went to deactivate the option Preferences / Contact Information, there is an option to switch on or off, something like “Show an simplified store locator” and turned it OFF. Reloading the page and inspect again with Dev Tools still show the warning messages (NoApiKeys and SensorNotRequired).

So finally I decided to go into database, table ps_configuration and alter the PS_STORES_SIMPLIFIED option, trying values 1, 0 but also NULL. Nothing happened to make me happy; and my coffe get cold already.

4. I decided to play around with StoresController.php file, and I comment all the function
*/public function setMedia()

Believe it or not, the warning message is still displayed, and looking on page source I see that the line
<script type=”text/javascript” src=””></script>
still loading…

I start searching through all files (an copy of the website is downloaded in my computer and have Dreamweaver installed) for words “sensor” and also in database. Nothing has found. I also searched by “” and found only few files, with no relevance except StoresControlles and AdminStoresController.

Finally, after few more hours of digging, I start thinking that most probably the issue comes from an module. And I downloaded again another copy of website to my local PC and search again for “sensor”. This time I found the evil. It seems that were some differences between moment when I have downloaded first time an copy of website and today, when I downloaded an second copy: in the meantime it seems that I have installed an module, named “Smart Short Code”. It will add a new menu in PS back-office, named “Shortcode” with 3 additional submenus (first one is Shortcode Content Anywhere – I use it to insert to custom blocks on homepage and on left menu). This module call the maps api on file smartshortcode.php, as in picture bellow.
I don’t know why, because as far as I see in options which this module offers, nothing point me to understand why this module need the maps api. Anyway, I cannot disable this module (need it) so I decided to comment this line on file smartshortcode.php:

//$this->context->controller->addJS(‘http’.((Configuration:: get(‘PS_SSL_ENABLED’) && Configuration:: get(‘PS_SSL_ENABLED_EVERYWHERE’)) ? ‘s’ : ”).’://’);

google mapi api call in smartshortcode.php

and voila, now all 2 javascript files are not loaded anymore, also the error message (warning, in fact) dissapear.
I spare this way few kB of javascript code to load in browser (js?sensor=true : 52,1 kB; common.js: 28,7 kB; and util.js: 93,2 kB)

No more SensorNotRequired, NoApiKeys


Leave a Comment