Google Maps API Key

As of Sunshine 2.9.1, Sunshine has a feature that allows your users to auto-complete their address at checkout. To configure this feature, all you need is a Google Maps API key with proper APIs enabled and enter it into Sunshine’s settings.

Here is how to  get your Google Maps API key and configure it:

Generate an API Key From Google Developer Console

Go to the Google Developer Console and select the project from the Select a Project menu at the top. If you don’t have any previously created projects, click New Project to create a new one.

Once you’ve successfully created a new project, click Enable APIs and Services. This will open a Google API Library.

From here, you’ll need to enable three 3 APIs:

  1. Geocoding API
  2. Maps JavaScript API
  3. Places API

This API library provides an easy search option; type the name of the API in the search box, go to your API and click the ENABLE button.

Once you’ve enabled all your APIs, go back to your Google Console dashboard and navigate the Credentials tab. Click on the Create Credentials button at the top and select the API key option.

A pop-up with an API key will open. Click on the RESTRICT KEY option at the bottom right corner of the pop-up. A new page will open, where you’ve to configure the following settings:

  • Application Restrictions: From here, you can select which websites, IP addresses, or applications you can use the API key. Here you’ll need to choose the HTTP Referrers option to allow your Key to be used within your websites.
  • Website Restrictions: Once you select the HTTP Referrers, a new option will be displayed, website restrictions. Here you need to add your website domain name to restrict the API Key to be used only by the specified websites.

Clicking the save button will redirect back you to the Credentials page. Copy your Key from the page and head back over to your WordPress Admin > Sunshine > Settings > Checkout tab. Enter your API key in the Google Maps API Key option.

You’re set! Just by having the key entered enables address autocomplete for both shipping/billing on the Checkout page.

Configure your Google Console billing account

Google Maps does require a billing account on file but provides a $200 credit on your account each month which makes it free for almost everyone. Address autocomplete will not work until you have billing information on file. Click here to see more information on how to set up your billing in Google Console.