The purpose of this tutorial is to show you the steps needed to use geolocation at your store checkout.
This function permits deliveries to use a geographical point as a basis (latitude and longitude) instead of a postal code.
How does this improve my store?
The geolocation function lets your customers manage their own searches for the required delivery address.
In other words, on checkout they can use a tool with the ability to find addresses on Google Maps with an icon marking the position.
This gives the user visual confirmation that the order will be delivered at the required address. The location information will be completed automatically as soon as the point is loaded on the map.
This function is especially useful in regions where the postal code system is not very accurate.
Setting up the logistics
To use this function, proceed as follows:
First of all, you must get a Javascript API Key for Google Maps, to permit integration with the Google geolocation service. You can read more about how to do this at:
https://developers.google.com/maps/documentation/javascript/get-api-key
Once you have an API Key, proceed as follows:
- In the VTEX Admin, go to Store Settings > Shipping > Geolocation Shipping, or type Geolocation Shipping in the search bar at the top of the page.
- Enter the API Key in the field indicated and click on Register Key.

In some countries, Google Maps does not provide high quality mapping. Therefore it is possible that some addresses will be written wrongly, or Google may indicate an incorrect address. In these cases, you must correct the address on the map itself.
Setting up the polygon
For this function to work correctly, you must register the polygons corresponding to the required delivery areas on the map. Then you must associate them with the transport companies making the deliveries, by including the IDs of these polygons in the freight charges table. To this, see the article Registering geolocation.
Setting up the Checkout
Once you've created the polygon and entered your ID in the shipping worksheet, you'll need to enter the Google Key API in the Checkout settings:
- In the VTEX Admin, go to Store Settings > Storefront > Checkout, or type Checkout in the search bar at the top of the page.
- Click on the icon of the desired website.
- In the blue options menu located at the top of the page, click on Checkout.
- In the Google Maps API Key field insert the API Key given in the logistics step.
Once the API Key has been included in the Checkout configuration, the geolocation will be visible in your store checkout.
How does the freight charges search work?
With geolocation at checkout, the freight charges calculation will always give priority to this option, using the polygons including the coordinates of the selected destination.
So, even if your client wants to use the postal code, geolocation will be the parameter used by the system to calculate the freight charges.