Google Maps not working on Shopify: how to fix it
Unlike Wix and Squarespace, Shopify themes that include a map section ask for your own Google Maps API key. When the map disappears, the cause is usually that key: missing from the section, restricted to the wrong domain, or attached to a project without billing.
Which kind of map do you have?
- A theme map section. Some Shopify themes include a Map section you add in the theme editor (Online Store → Themes → Customize). Shopify's help says the map won't show until you register a Google Maps API key and add it in the map section's settings. Many current themes don't include a map section at all.
- A Custom Liquid section or a page with an iframe. A share embed copied from Google Maps, which needs no key, or a Maps Embed API iframe, which does.
- A store locator or map app. These load the Maps JavaScript API themselves, with a key you entered in the app or one the app provides.
To check, open the theme editor, click the map on the page preview and look at the section settings in the sidebar. A theme map section has a Google Maps API key field. A Custom Liquid section shows code.
How to tell what's wrong
- The map section shows its background image or colour instead of a map. Shopify's help says the section falls back to the background set in the theme editor when it can't reach the Google Maps APIs. This is the most common Shopify symptom, and it means the key or the Google project has a problem.
- Map works in the theme editor but not on your domain, or the other way round. The key's referrer restrictions cover one domain and not the other.
- Map broke after you switched or updated the theme. The key lives in the theme's own settings, so a different theme, or a new copy of the theme, may not have it.
- Map broke after you installed an app. Two copies of the Maps JavaScript API are loading.
- Map missing until a visitor accepts cookies. A consent app is blocking Google scripts.
Open the storefront, press F12 and check the Console tab. With a referrer problem you'll see:
The last line tells you the exact address Google saw. If it's a domain you haven't allowed, that's your fix.
Why it happens
- The key field is empty. After a theme switch, a theme update installed as a new copy, or a duplicated theme, check the field before anything else. You'll see MissingKeyMapError or the background fallback.
- The key is restricted to the wrong domains. Shopify recommends restricting the key to HTTP referrers and including your .myshopify.com domain as well as your custom domain. Forgetting one gives RefererNotAllowedMapError.
- The API isn't enabled. Shopify's help asks you to select the Maps, Routes and Places products when you set up the key for the theme map section. If one the section needs is missing, you get ApiNotActivatedMapError or a denied geocoding request.
- No billing account. Google requires a billing account on the project. Without one, the console shows BillingNotEnabledMapError.
- The key was deleted or rotated. Someone tidied up Cloud Console, or rotated a leaked key, and didn't update the theme.
- Duplicate loaders. A store locator app and the theme both load the Maps JavaScript API. Google warns “You have included the Google Maps JavaScript API multiple times on this page” and either map can break.
The fix, step by step
- 01In Shopify admin, go to Online Store → Themes and click Customize on the live theme.
- 02Select the map section and look at the Google Maps API key field. Copy the value. If it's empty, that's the problem.
- 03In Google Cloud Console, open APIs & Services → Credentials and find the key. If it isn't there, check the project picker, then create a new key if it's gone.
- 04Open the key's settings. Under application restrictions, choose websites (HTTP referrers) and add both your-store.myshopify.com/* and yourdomain.com/*, plus www.yourdomain.com/* if you use it. Shopify's help asks for a wildcard path on each.
- 05Check the APIs the key is allowed to call. If the key has API restrictions, every API the theme uses must be in its list as well as enabled on the project. The console names the missing one in ApiNotActivatedMapError.
- 06In Billing, confirm the project is linked to an active billing account.
- 07Paste the key into the section's field with nothing around it and click Save.
- 08Reload the storefront in a private window. Restriction changes can take a few minutes to apply.
Removing the referrer restriction makes the map work, but anyone who views your page source can copy the key and spend your quota. Add the missing domain instead. If the key has already been copied, see rotating a leaked key.
If an app also loads Google Maps
Store locators, delivery date pickers and address autocomplete at signup all tend to load the Maps JavaScript API. With a theme map on the same page, you get two loaders, often with two different keys.
- 01Open the page source and search for maps/api/js. Count the results and note the key= value in each.
- 02Disable the app's embed for that template in the theme editor (App embeds in the theme settings, if the app uses one), or remove the theme map section from that page.
Keyless alternative
If you only need to show one shop location, you can skip the key entirely. In Google Maps, find your shop, choose Share → Embed a map and copy the HTML. Paste it into a Custom Liquid section or a page's HTML view. Remove the theme map section so nothing is left loading the API. See replacing a broken iframe embed.
Consent apps
Consent and cookie apps commonly block Google scripts and iframes until the visitor agrees. A blocked map looks the same as a broken one to the visitor. Open a private window, don't touch the banner, and see whether the map appears. If it only appears after consent, check the app's settings for Google Maps and make sure the placeholder explains what to do.
Confirm it is fixed
Check both your custom domain and your .myshopify.com address in a private window, with the console open. There should be no Google Maps errors and the map should replace the background image. Then run a scan on the page with the map. It loads the page from a clean session and lists every Google Maps request and console error, which shows a second loader from an app even when the map looks fine.
Common questions
Does Shopify provide a Google Maps API key?
Not for theme map sections. Shopify's help asks you to register your own Google Maps API key, with a billing account, and paste it into the map section's settings. Keyless share embeds and some apps don't need one from you.
Why does my Shopify map show an image instead of a map?
Theme map sections fall back to their background image or colour when they can't reach Google Maps. Check the key field, the key's referrer restrictions, the enabled APIs and billing.
Which domains should I add to the key's restrictions?
Your .myshopify.com address and every custom domain you use, each with a wildcard path such as yourdomain.com/*. Include the www version if your store uses it.
Will a theme update remove my Google Maps API key?
The key is stored in the theme's settings. If you move to a different theme, or a new copy of your theme, check the map section's key field after the switch.
A scan tells you in about twelve seconds, from a clean session.