WebData Distance Based Fee for WooCommerce


This plugin uses Google Matrix API to add custom fee based on distance between customers destination city and online stores location. Fee will be calculated by dividing the distance with user entered divider, and then multiplicated by the price. For example, if distance is 100km and the divider is 2 and price is 5 euros (Fee will be 5 euros for every 2 kilometers). The calculation formula will be (100 / 2) * 5 = 250 euros.

Installation instructions here.

If you are looking for a shipping method with distance based fee support, then use this plugin instead.

Works with any currency and you can use either kilometers or miles.

You can use different logics, based on minimum and maximum distance or minimun cart price. Also fixed fee is available if the conditions are not met and you can disable the fee on virtual products. If you need to create your own logic, the filters to be used can be found here: https://web-data.online/docs/woocommerce-distance-based-fee/

Plugin settings can be found at Settings – Distance based fee settings.

You need to have a Google API key in order to use this plugin. More info: http://tiny.cc/aab75y

Google now also requires billing to be enabled for your account. Enable it here: https://console.cloud.google.com/project/_/billing/enable
More info: https://developers.google.com/maps/premium/new-plan-migration

This plugin requires WooCommerce version 3.2.0 or later.


Installing “WooCommerce distance based fee” can be done either by searching for “WooCommerce distance based fee” via the “Plugins > Add New” screen in your WordPress dashboard, or by using the following steps:

  1. Download the plugin via WordPress.org
  2. Upload the ZIP file through the ‘Plugins > Add New > Upload’ screen in your WordPress dashboard
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. Adjust settings at: Settings – Distance based fee settings


I can not see any fee on my checkout

1) Google has changed their policy, and now you need to have a billing account enabled, in order to use their API. More info: https://console.cloud.google.com/project/_/billing/enable

2) Check your plugin settings, you need to have enabled atleast one shipping method for the fee.

3) Check error log for possible errors. You can find the log at the plugin settings page on “Logs” tab.

4) Choose one of the WooCommerce shipping methods at WooCommerce – Shipping and save any of the shipping methods settings once to clear the cache.

5) Make sure you have entered your store location correctly on WooCommerce settings, and Google can locate it through Google Maps.

6) Make sure you have enabled correct API. Try to enable the following APIs: Distance Matrix API, Places API for Web, Google Maps Geocoding API

7) Try to generate new API key and do NOT choose restricted mode.

8) If you still have issues, contact through the Support forum.

My settings does not take effect on checkout page

This may be caching issue. Try to choose one of the WooCommerce shipping methods at WooCommerce – Shipping and save shipping methods settings once. Also if you use any caching plugins, clear those plugins’ cache also.

I can not see any shipping methods

You may have some issue in your WooCommerce settings or another plugins can cause this as well. Check Distance Based Fee settings and be sure to select at least one shipping method for the fee. If address cannot be found, selected shipping method will be disabled.


January 24, 2020
Was looking for a plugin for a client site where they needed an easy way to charge delivery costs based on distance from their workshop. I'm pleased to say this plugin did exactly what we wanted. The only one tiny niggle for me is that although you can set a minimum distance that the cost per distance should apply to, there is no option to only calculate the cost on the extra distance above the minimum. Thankfully the plugin has a handy dbf_calculated_fee filter which is easy to hook into if you need to manipulate the extra shipping cost like we needed to.
January 10, 2020
Just what I needed, working as intended. Well done!
Read all 7 reviews

Contributors & Developers

“WebData Distance Based Fee for WooCommerce” is open source software. The following people have contributed to this plugin.




  • PHP8 & WC5 check


  • Only zip and city required API fields


  • Added support for Google API status: ZERO_RESULTS


  • Better mielage support


  • No API calls if destination is not set


  • No API call if hiding is disabled based on distance limits


  • Minor bug fixes


  • Added minimun cart price
  • Added option for alternative starting point address
  • Added hooks for from shipping address, zip and city


  • Billing address can be selected instead of shipping address


  • Bug fixes


  • Added option to disable on virtual products


  • Improved logging


  • Improved logging


  • Minor bug fixes


  • Readme update


  • New logics: Fee based on minimum and maximum distances
  • New logics: If conditions are met, how to handle the chosen shipping methods
  • Fixed fee
  • Better support for error logging


  • FAQ updated


  • Author updated


  • Readme.txt update


  • Minor issues
  • Readme.txt update


  • Improved debugging
  • FAQ Added

  • Added filter: dbf_calculated_fee for filtering the price

  • Updated readme

  • WordPress 5.2 support


  • WordPress 5.0.3 support


  • WordPress 4.9.1 support


  • Curl changed to wp_remote_get() function


  • Hide shipping methods if destination cannot be found


  • Initial release