Calculate distance shipping by route not by straight line

WCMp Core

Resolved
Viewing 3 reply threads
  • Author
    Posts
    • #135657
      israelpelayo
      Participant

      Hello, thank you for you support and your services.

      At checkout, the distance-based shipping cost is calculating the distance in a straight line, not by the route. How can I make the calculation of the distance be done by route? I use the Google Maps API.

      Thank you very much.

    • #135686

      Hi,
      Then you to do complete customization. First, you need to check from google API doc exists or not. If exist then you need to modify the complete calculation.

    • #135689
      israelpelayo
      Participant

      Thanks for your reply.

      I do have the Google Maps api activated, and it can call all Google APIs, because in my configuration I don’t have it restricted. In this sense, it is understood that it can call Directions API, Distance Matrix API, Geolocation API, etc.

      I don’t know if this configuration is correct or what I have to do in particular. Could you please guide me or give me some document or page showing how to do API configuration?

      I thank you very much.

      Best regards.

    • #135765

      Hi,
      It will be huge customization. We are trying to give some explanation.
      Here https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/blob/master/includes/wcmp-core-functions.php#L2907 we have calculated the distance between two lats and lang. In this way, we find the distance. Now if you want to change this then first you have to check google API doc for road time calculation then you have to implement it here.

Viewing 3 reply threads

The topic ‘Calculate distance shipping by route not by straight line’ is closed to new replies.