Import geocodes for Inventory Management

Inventory Management provides the Distance Priority algorithm, which helps determine the best option for shipping a full or partial order. The algorithm uses GPS information or geocodes to calculate the distance between the source (a warehouse or other physical location) of each item in an order and the shipping address. Based on those results, the algorithm recommends which source should be used to ship out each item in the order.

The merchant selects the provider of the GPS or geocode data required to calculate distances:

  • Google MAP uses Google Maps Platform services to calculate the distance and time between the shipping destination address and source locations. This option requires a Google billing plan and may incur charges through Google.

  • Offline calculation calculates the distance using data downloaded from geonames.org and imported into Magento with a command. This option is free of charge.

To import geocodes for offline calculation

Enter the following command with a space-separated list of ISO-3166 alpha2 country codes:

bin/magento inventory-geonames:import <country code> <country code> ...

For example:

bin/magento inventory-geonames:import us ca gb de

The system downloads and imports the geocodes data to your database, then displays the message Importing <country code>: OK.