How to calculate with a table if we charge client per km of delivery?

Top WooCommerce & WordPress Plugins Forums Custom Shipping Methods for WooCommerce How to calculate with a table if we charge client per km of delivery?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #94558
    Konstantin
    Guest

    Hello
    How to calculate with a table if we charge client per km of delivery?
    Thanks

    #94559
    Tom Anbinder
    Moderator
    Plugin Support

    Hi Konstantin,

    The idea is really interesting and I would gladly implement it in plugin, however there is one major problem – plugin would need to know the distance between your shop and the customer. For plugin to calculate the distance, it would need to know the coordinates (i.e. latitude and longitude) of both your shop and the customer. In standard WooCommerce setup, customer enters ZIP code, so we could try go get latitude and longitude from ZIP code, but this would definitely require some external API, which would connect ZIP codes with coordinates. If you have any thoughts on how to solve this – please let me know.

    Simple solution would be acceptable if your shop deliver to small (or at least finite) number of ZIP codes – in this case we could manually pre-fill the table of ZIP codes -> distances. Hope you get the idea…

    #94560
    Konstantin
    Guest

    We deliver by cars, cars use roads and only distance we can get – from direction of any mapping service: google, yandex, waze. When you install woocommerce you fill an address of your store/warehouse, when client place order – they fill the address of delivery. When you have 2 addresses you can calculate distance between them with any maps API, google distance matrix for example – https://developers.google.com/maps/documentation/distance-matrix/intro
    If you can implement it in a plugin – I’ll be your first client who bought it :)) I think this plugin will be useful for any who make local delivery.

    #94561
    Tom Anbinder
    Moderator
    Plugin Support

    Hi Konstantin,

    We’ve just released new plugin version 1.3.0. As suggested I’ve added calculation by distance, e.g.:

    1.5*[distance key="BIzbSyBNBNR9yi3vTgC33oXSpwQftScNSmO-fjc" default="15" debug="yes" units="km"]

    and/or

    [costs_table prop="distance" table="1-10|50-50|100-125.5" key="BIzbSyBNBNR9yi3vTgC33oXSpwQftScNSmO-fjc" default="125.5" units="km"]

    Unfortunately both shortcodes went to Pro version only, hope you understand.

    You can read more about these shortcodes in the “Description” tab.

    Please let me know if something is not working as expected or if you have any questions. Any feedback is highly appreciated.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.