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, as well as the number items in the cart, weight of the items, and the total value of the cart.
Installation ↑ Back to top
- 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 ↑ Back to top
The first step in setting up the WooCommerce Distance Rate Shipping extension is to generate a API key on Google, as the extension makes use of the Google Maps and Google Distance Matrix APIs.
Obtain a Google API Key ↑ Back to top
- 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 Google Maps Distance Matrix API.
- Click on the Enable button.
- Then Create to create a new project
- 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 Add credentials and choose API key.
- A window will pop up, with your new API key. Copy the API key generated in the pop-up box and keep it as you will need to enter this in the WooCommerce Distance Rate Shipping extension settings.
- After you copy your API key, close the box and click Overview in the left column. Once again, expand the list of the Google Maps APIs by clicking More and then click Google Maps Embed API.
- 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.
Store setup ↑ Back to top
1/ Go to: WooCommerce > Settings > Shipping.
2/ Select your Shipping Zone that you want to add the method to, and press the Add shipping method + button on the right
3/ Select Distance Rate from the dropdown and press Add shipping method:
4/ Click on the new Distance Rate method to configure the settings:
- Method Title – Name the shipping method. This is visible to customers.
- Method Title – Title you want to display to the customer at cart/checkout
- Tax Status – Whether the rates includes tax or not.
- Transportation Mode – Method of transportation that is being used for delivering your products.
- Avoid – Things to avoid when working out the distance, like Ferries, Tolls etc.
- Distance Unit – Whether to use the Metric or Imperial system for working out distances.
- Show Distance – Whether to show the actual distance on the cart/checkout pages when presenting the customer with their shipping rate.
- Shipping Address – The address from where you are shipping from, this can be your store location or if you ship from a different location to your store enter the address of that location here.
Distance Rate Rules
5/ Enter Distance Rate Rules to define different settings for shipping.
You can set up rules based on the distance, total travel time, cart item count, weight or cart total value.
Multiple rules can be set up with different options:
- Min and Max to specify a range the type will fall in
- Fixed Cost to apply if the rule matches
- Cost Per Distance / Minute is the value to charge based on the total travel time or distance to the customer address
- Handling Fee allows you to enter a value charged on top of shipping.
- Break option will not process any rules if this line matches.
If you select Total Travel Time, it uses the travel time when the order is paid for in checkout.
A working example is:
- Range 1: 1-9.9 miles
- Range 2: 10-24.9 miles
A nonworking example is:
- Range 1: 1-10 miles
- Range 2: 10-25 miles
6/ Save changes.
Error showing on Distance Rate Shipping settings page: ‘Google Maps Platform rejected your request. This API project is not authorized to use this API’ ↑ Back to top
This can happen when Google Maps Embed API is not enabled for the project you created. Open the Google Developer Console and make sure that both Google Distance Matrix API and Google Maps Embed API are added to the project.
Questions & Feedback ↑ Back to top
Have a question before you buy? Please fill out this pre-sales form.
Already purchased and need some assistance? Get in touch with a Woo Happiness Engineer via the Help Desk.