Use Google Maps
You do not need a Google account to get started. The process includes Google account and project creation, if needed. This option requires a billing account and payment method added to your Google account to complete configurations and use the algorithm.
However, Google MAP distance-based algorithm is recommended as more advanced and precise in comparison to Offline Calculation.
Step 1: Create the Google API key
The key is from the Google Maps Platform and should have Geocoding API and Distance Matrix API enabled. For details, see Configuring Distance Priority Algorithm.
-
Visit Google Maps Platform and click Get Started.
-
To enable the platform, select Maps, Routes, and Places and click Continue.
-
Sign in with a Google account or create an account.
-
Set up a project:
-
Select a project or enter a new project name.
-
To accept the terms, select
Yes
. -
Click Next.
-
-
Enter a billing account or create one. You can skip and add a billing account later.
A billing account is required to use this service.
-
To open and configure your Google Cloud Platform options, click Console.
-
Open your project.
-
Expand the menu and click APIs & Services > Library.
-
Search for Geocoding API and Distance Matrix API. Select and enable each service.
-
-
Expand the menu, click APIs & Services > Credentials, and copy the Google API Key.
Step 2: Configure the Google MAP Provider
-
On the Admin sidebar, go to Stores > Settings > Configuration.
-
In the left panel, expand Catalog and choose Inventory.
-
Expand
Google MAP
. -
Expand
-
For Google API Key, enter the key copied from your Google account.
-
For Computation mode, select a configuration.
NOTE
When using this algorithm for shipping, if routes and data do not return for the selected Computation mode (driving, bicycling, or walking) for a shipment, the SSA defaults to using the Source Priority. Setting the priority for sources per stock is recommended.Option Description Driving
(Default) Requests standard driving directions using the road network. Walking
Requests walking directions using pedestrian paths and sidewalks (where available). Bicycling
Requests bicycling directions using bicycle paths and preferred streets (where available). The Distance Matrix Service is only available in the US and some Canadian cities. -
For Value, select a value type:
Option Description Distance
(Default) Returns the distance between points in metrics (kilometers and meters) or imperial (miles and feet). Time to Destination
Returns the time required to travel from the source locations to the shipping address in hours and minutes.
-
-
When complete, click Save Config.
Use offline calculation
Offline calculations use country codes to determine the distance between the shipping destination and source addresses. This option may require developer assistance to configure. Use an Inventory Management CLI command to download and import data from geonames.org.
Step 1: Download and import geocodes
Complete command-line configuration to download and import geocodes countries to ship to and have source locations in. This step may require developer assistance for help with command-line tasks. Refer to Import geocodes.
Complete these commands anytime you want to add more geocodes.
Step 2: Set the calculation
-
On the Admin sidebar, go to Stores > Settings > Configuration.
-
In the left panel, expand Catalog and choose Inventory.
-
Expand
-
Deselect the Use system value checkbox and set Provider to
Offline Calculation
. -
When complete, click Save Config.