WooCommerce Distance Rate Shipping allows you to set up rules and charge rates based on the distance from your shipping location to the customer’s location.
Rules can be set up to charge shipping based on the distance and total travel time, or the number items in the cart, weight of the items, or the total value of the cart.
This extension requires a Google account as it makes use of Google Maps, the Google Distance Matrix API, and Google Maps Embed API. Some of these features are paid services. The route returned (and subsequent total distance) is used to calculate the cost according to the data returned by Distance Matrix API’s “Driving” Mode.
Installation
- Download the .zip file from your WooCommerce account.
- Go to: WordPress Admin > Plugins > Add New and Upload Plugin with the file you downloaded with Choose File.
- Install Now and Activate the extension.
More information at: Install and Activate Plugins/Extensions.
Setup and Configuration
The first step in setting up the WooCommerce Distance Rate Shipping extension is to generate an API key on Google, as the extension makes use of the Google Maps and Google Distance Matrix APIs.
Obtain a Google API Key
- Go to: https://console.developers.google.com project and sign in with your Google account.
- On the Dashboard screen, click the Library link from the left-hand menu. Then search for and click Google Maps Distance Matrix API
- Click on the Enable button.
- Create to create a new project if needed
- Give your new project a name, i.e., Distance Rate Shipping, and then click Create.
- Click the Enable API button, then click the Credentials tab from either the left-hand menu or the banner across the top
- Click Create credentials and choose API key.
- A window will pop up, with your new API key, select Restrict Key.
- Make sure the restrictions are set to
None
andDon't restrict key
and select Save
- Copy the API key generated and keep it as you will need to enter this in the WooCommerce Distance Rate Shipping extension settings.
- After you copy your API key, select APIs in the left column.
- Select the Maps Embed API under Additional APIs
- Click the Enable API button


API & Debug
Go to: WooCommerce > Settings > Shipping > Distance Rate.
- API Key – You Google API Key as obtained per instructions above in the Obtaining Google API Key section
- Debug Mode – Enable this to view the API calls on the Cart/Checkout page to debug distance issues.
Enable Billing on Google Cloud Platform
As this extension makes use of Google Cloud service (Google Maps and Google Distance Matrix APIs), to ensure the extension work properly, you need to enable billing for your Google Cloud Project on the Google Cloud Platform:
- Navigate to the project page on your Google Cloud Platform
- Select the project you created during your initial setup for this extension
- Click Create Billing Account and complete the rest of the process

Store setup
Go to: WooCommerce > Settings > Shipping.
Select edit on the Shipping Zone that you want to add the method to

Select the Add shipping method button on the bottom of the Shipping methods section

Select Distance Rate