Enabling a Google API key for Ruby storefront

To use Google Maps in a Ruby storefront, the store build process requires a Google API key access.

This access enables the following services for a Ruby storefront.
  • Directions API
  • Distance Matrix API
  • Maps JavaScript API
  • Places API

Procedure

To add a Google API key to the store:
  1. Configure the APIs on your Google account.
    1. Enable the Google API on the Enable and disable APIs page of your Google account.
    2. Configure the Google API on the Setting up API keys page of your Google account.
  2. Export the environment variable MAP_API_KEY=<your-google-API-key>.
    1. Development environment: Set MAP_API_KEY=<your-google-API-key> in .env.local file.
    2. Production environment: Set or export MAP_API_KEY=<your-google-API-key> system environment variable for your container.
    Note: Refers to the actual Google API key fetched in Step 1.a.
  3. Start development server or production server.

Results

Once the API key is enabled, users can access the Google Maps with the Store Locator feature.