Map toolbox

The map toolbox appears when you hover over the map container.

ToolIconDescription
Move Move icon Moves the map to another position on the stage.
(label)MapIdentifies the current content container as a map. Hover over the map container to see the toolbox.
Settings Settings icon Opens the Edit Map page, where you can change the properties of the map and container.
Hide Hide icon Hides the current map.
Show Show icon Shows the hidden map.
Duplicate Duplicate icon Makes a copy of the map.
Remove Remove icon Deletes the map from the stage.
NOTE
Hidden elements are stored in the database and invisible to customers. However, these elements are visible to search engines and other bots that crawl your site. They are also returned as part of the content if requested through an API call with an attribute of invisibility, unless you remove them from the stage.

Configure Google Maps for your Admin

Before adding a map, you must first open an account for a free trial of Google Maps Platform. The free trial lasts for 12 months and includes a $300 credit. If you use up your credit, Google does not bill your account without your permission.

Step 1: Get your Google Maps API key

Depending on whether you already have a Google Maps key, use one of the following procedures to get the API key required for configuration. To set up a Google Maps key, you must be a site administrator authorized to enable billing for your account. If you’re not ready to set up a Google Maps Platform account, you can skip this step and use the placeholder map for now.

  1. Go to the Google Cloud Platform Console.

  2. Click the project drop-down and select or create the project for which you want to add an API key.

  3. To configure your API credentials, follow the instructions in the Google Maps documentations.

  4. Copy your API Key to the clipboard.

Step 2: Configure Google Maps in Commerce

  1. In the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel under General, choose Content Management.

  3. Expand Expansion selector Advanced Content Tools.

    Advanced Content Tools

    For more information about the Content Management Advanced Tools configuration options, see the Configuration Reference Guide.

  4. For Google Maps API Key, paste the key you copied in step 1.

  5. Click Test Key.

    If there is a problem with your key, return to the Google Maps Platform site to resolve the problem. Then, try again.

  6. After your key is verified, click Save Config.

Add a map to the stage

  1. Open the page, block, or dynamic block to the Page Builder workspace.

  2. In the Page Builder panel, expand Media and drag a Map placeholder to the stage.

    Dragging a map to the stage

    If Google Maps Platform is configured for your store, a map appears for your store location.

    Google Maps

    If Google Maps Platform is not yet configured for your store, a placeholder map appears instead.

    Google Maps Placeholder

Add a custom map location

  1. Hover over the map container to display the toolbox and choose the Settings ( Settings icon ) icon.

  2. In the upper-right corner of the Edit Map page, click Add Location.

  3. Enter the Location Name that you want to be associated with the pin on the map.

  4. Collect the location coordinates that you want to use for the custom location.

    Alternatively, in the Position box, you can drag the pin in the displayed map.

    If necessary, go to Google Maps in a new browser window and use one of the following methods to get the coordinates:

    Map Coordinates

    Method 1: Copy from URL

    • In the upper-left corner, enter the address in the Search box and click the Search ( Search icon ) icon.

    • Copy the coordinates in the URL and paste them into a notepad.

    Method 2: Copy from “What’s here?”

    • Right-click the red pin that marks the location on the map and choose What’s here? in the menu.

    • In the displayed label, copy the text, including the coordinates and paste the text into a notepad.

  5. Enter the numbers, without the comma, in each of the Coordinates boxes.

    You can also enter as much of the remaining information that you want to be available on the map.

  6. Compete any other information that you want to associate with the map location:

    OptionDescription
    Phone NumberThe telephone number of the location.
    Street AddressThe street address of the location.
    CityThe city of the location.
    Region/StateThe region or state of the location.
    Zip/Postal CodeThe ZIP or postal code of the location.
    CountryThe country of the location.
    CommentAny comments that you want to include.
  7. When complete, click Save.

    The new location appears in the map and in the map location grid on the Edit Map page.

    Page Builder - maps location grid

Style the map

Use the Google Maps Platform Styling Wizard to apply a one of six predefined themes or to create a custom theme. You can generate a JSON file with the map style properties or a link to the styled map.

Change the map style

  1. In the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel under General, choose Content Management.

  3. Expand Expansion selector Advanced Content Tools.

  4. Under the Google Maps Style text box, click Create Map Style.

    This action opens the Google Maps Platform Styling Wizard in a separate tab, where you can define a style for your Google Maps Platform project.

  5. Click Create a Style and follow the provided instructions.

    When complete, click Finish.

  6. Export the completed style as JSON code or as a URL so that you can add it to the Commerce configuration.

    • JSON: Below the box with the generated JSON code, click Copy JSON.

    • URL: Below the box with the generated URL, click Copy URL.

  7. Return to your Admin browser tab and paste the generated code or URL into the Google Maps Style box.

    If you are using a URL, replace the YOUR_API_KEY placeholder with your Google Maps API key. This URL links to your styled Google Map.

  8. In the upper-right corner, click Save Config.

Change the map settings

  1. Hover over the map container to display the tool box and choose the Settings ( Settings icon ) icon.

  2. Change the basic settings as needed:

    OptionDescription
    HeightSpecifies the height of the displayed map in pixels.
    Show ControlsDetermines if the standard Google Map controls appear.
  3. Modify the Advanced settings as needed:

    • To control the horizontal positioning of the map content that added to the container, choose an Alignment:

      OptionDescription
      DefaultApplies the alignment default setting that is specified in the style sheet of the current theme.
      LeftAligns the content along the left border of the map container, with allowance for any padding that is specified.
      CenterAligns the content in the center of the map container, with allowance for any padding that is specified.
      RightAligns the content along the right border of the map container, with allowance for any padding that is specified.
    • Set the Border style applied to all four sides of the map container:

      OptionDescription
      DefaultApplies the default border style that is specified by the associated style sheet.
      NoneDoes not provide any visible indication of the container borders.
      DottedThe container border appears as a dotted line.
      DashedThe container border appears as a dashed line.
      SolidThe container border appears as a solid line.
      DoubleThe container border appears as a double line.
      GrooveThe container border appears as a grooved line.
      RidgeThe container border appears as a ridged line.
      InsetThe container border appears as an inset line.
      OutsetThe container border appears as an outset line.
    • If you set a border style other than None, complete the border display options:

      Border Color

      OptionDescription
      Border ColorSpecify the color by choosing a swatch, clicking the color picker, or by entering a valid color name or equivalent hexadecimal value.
      Border WidthEnter the number of pixels for the border line width.
      Border RadiusEnter the number of pixels to define the size of the radius that is used to round each corner of the border.
    • (Optional) Specify the names of CSS classes from the current style sheet to apply to the map container.

      Separate multiple class names with a space.

    • Enter values, in pixels, for the Margins and Padding to specify the outer margins and inner padding of the map container.

      Enter each corresponding value in the map container diagram.

      Container areaDescription
      MarginsThe amount of blank space that is applied to the outside edge of all sides of the container.
      PaddingThe amount of blank space that is applied to the inside edge of all sides of the container.
      NOTE
      Padding is not available for the Map content type.
  4. When complete, click Save to apply the settings and return to the Page Builder workspace.