Distance by Postcode

Makes it possible to get the distance between to addresses (by postcode).

⚠️ In order to use this option a valid API key must be added on the plugin's settings page. The steps of how to get the API key are described on the page about Google Map option. The following API must be enabled:

👉 Maps JavaScript API

👉 Geocoding API

This option has two modes: single and dual

Single mode

This mode should be used when you need to get distance between your postcode (origin) and user defined (destination). For instance, you want to get the distance for delivery service. You have to define origin's postcode and country in this case.

Dual mode

This mode should be used when you need to let user define both origin and destination postcodes and get distance between these two. In this case you have to define only country.

Why must I define country?

Google distance API works so you have to set country name explicitly, otherwise the will be wrong distance/calculation. This is the limitation of the API.

Information about variables

This options' main variable holds destination postcode value. Additionally, the option has two special variables which ends with:

...origin} - origin's postcode

...distance} - distance between origin and destination, km

In dual mode origin is the first input and the destination is the second:

Last updated