Vendors can now calculate the shipping based on the distance using the Distance rate shipping feature. The cost will be calculated based on the distance from the vendor 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 of items in the cart, the weight of the items, or the total value of the cart.
Here’s how to set up the distance rate shipping of Dokan.
Pre-requisites
- WooCommerce
- Dokan Lite
- Dokan Pro (Latest Version)
Enable Table Rate Shipping Module – Admin
First of all, you need to enable the module from the backend. Navigate to WP-Admin–> Dokan–> Modules. Here enable the Table Rate Shipping module.

Create Shipping Class and Shipping Zones – Admin
Now, if you have set up shipping zones and shipping classes beforehand, then you can skip this step. Else, you can set up shipping zones and shipping classes from WooCommerce–> Settings –> Shipping.

Add Shipping Method – Admin
After enabling the Table Rate Shipping feature, you will find a new shipping method in the shipping method list ” Vendor Distance Rate Shipping“. Select this method to your selected zone. You can choose other methods as well.
Select your shipping zone and there click on the Add Shipping Method option.

Choose the Vendor Distance Rate Shipping from the dropdown box,

After adding the shipping method, hit the Save Changes button.

Configure Google/Mapbox API
Now, the admin needs to enable the Map API source. This will enable the system to configure the distance between the vendors location to customer’s location and help calculate the shipping charges. Admin will find the settings in Dokan–> Settings–> Appearance.
Here, admins need Google Map API and save the settings.

The admin part is done.
Note: Without google maps API key distance rate shipping will not accessible for vendors.
Configuring Distance Rate Shipping – Vendor
The vendor can configure the distance rate shipping right from the vendor dashboard. Navigate to Vendor Dashboard–> Settings–> Shipping. There click on the Edit option for the selected shipping zone.

In the next page, the vendor needs to add the shipping method. Click on the Add Shipping method option,

Select Distance Rate Shipping from the dropdown box,

Enable the shipping method and Hit the Save Changes button.

How to Add Different Rules
After the Zone settings are saved successfully, vendors need to edit the shipping method to set their respective rules.

On the next page, the vendors will find different fields to set up shipping rules,
- Method Title – Name the shipping method. This is visible to customers.
- 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; None, Tolls, Highways, or Ferries.
- 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.
- Show Duration – Whether to show an approximation of how long the delivery would take.
- 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.

You will find different distance rules to set your shipping charges,
- Condition is to specify what rules are based on, be it distance, total travel time, cart item count, weight, or cart total value.
- Min and Max to specify a range the type will fall in (travel time based in Minutes). Leave the fields blank if there is no limit.
- Base Cost to apply if the rule matches, excluding tax. Other calculations will be added on top of this cost.
- Cost Per Distance / Minute is the value to charge based on the total travel time or distance to the customer address, excluding tax.
- Handling Fee allows you to enter a fixed amount or percentage that is added to the shipping cost (such as 2.50 or 5%).
- Break will stop looking for any other rates below this rule (top-down), if the condition is met. Rates calculated up to the Break point will be offered.
- Abort will disable this shipping method, if the condition is met. No rates will be offered.

Here are some examples to understand how distance rate-based shipping works.
Example 1:
If the distance is between 1km-100km, then for every km the vendor will charge $1. So,
Condition: Distance
Min: 1km
Max: 100km
Per Distance Cost: $1

If the total amount of the order is $90, and the distance is 1.9Km then the shipping charge will be ( 1*1.9)=$1.9. The total amount will be $91.9.

Example 2:
If it takes 1-100 minutes to complete the order, then for every minute the vendor will charge $1.
Condition: Total Travel Time
Min: 1m
Max: 100m
Per Distance Cost: $1

Here is the calculation,

Example 3: The break option will tell the system to stop calculating after the first condition is met.
Condition 1: Distance
Min: 1km
Max: 100km
Per Distance Cost: $1
Condition 2: Total Travel Time
Min: 1m
Max: 100m
Per Distance Cost: $1

Here’s what the cart page will look like, as the distance condition is met, it will not calculate the total travel time condition.

So, this is how you can configure the distance rate shipping module for Dokan.