Showing your shop, office or event location on a map usually means pasting embed code from Google into a CMS page. This module integrates Google Maps into Magento instead: maps are placed with widgets in CMS pages and blocks, configured with a form, and use your own Google API key. It also provides the address lookup (geocoding) that other modules such as “Retail Store” use to find locations.
Features
- Widget “Google Maps Simple Marker”: a map with one marker defined by latitude and longitude, with an optional title and an info window with formatted text.
- Widget “Google Maps Json Marker”: a map with any number of markers, each with coordinates, title and optional info window.
- Widget “Google Maps Autocomplete”: adds Google’s address suggestions to an input field, optionally restricted to certain countries.
- Map options per widget: width and height, zoom level, and whether to show the zoom, map type, Street View, rotate, scale and fullscreen controls.
- Show or hide map details per widget: administrative areas, landscapes, points of interest, roads, transit stations and lines, bodies of water.
- The map language follows the locale of the store view.
- The Google Maps script is only loaded on pages that actually contain a map or autocomplete widget.
- Address lookup via the Google Geocoding API. Results are stored in the database, so the same address is not requested twice. An agency can also run a lookup from the command line for testing.
Configuration
Go to Stores > Configuration > Infrangible Solutions > Google Maps:
- “Settings”: “Enabled” and the “API Key” for Google Maps.
- “Geocoding API”: “Use Maps key” (default) or enter a separate “API Key” for address lookups.
Settings can be made per website and store view. The maps themselves are added with “Insert Widget” in the editor of CMS pages and blocks.
Good to know
You need a Google Maps Platform account with an API key that allows the Maps JavaScript API, the Places API (for autocomplete) and the Geocoding API. For stores using the Hyvä theme, install the companion module “Google Maps Hyvä Theme”.
Installation
Install the module with Composer in your Magento root directory:
composer require infrangible/m2-google-mapsThen enable it and update the store as described in the installation guide. Composer installs the required modules listed on this page automatically.
Using the Hyvä theme? Also install the companion module Google Maps Hyvä Theme:
composer require infrangible/m2-google-maps-hyva