Hi,
Can you give me origin address and destination address, so I can check the API response and I can try to recreate your issue myself.
Kim
Sorry to say that I made a mistake; I’m using “ WebData Custom Shipping Methods for WooCommerce” plugin, not this one.
Don’t know if they share same code.
Anyway:
Origin/Store address: Via Amendola 25 – 98071 Capo d’Orlando (ME) {written without apostrophe to avoid backslashes}
Destination: Via Amendola 5 – 98071 Capo d’Orlando (ME)
– Italy, Sicily –
Ok, here is the response:
{“destination_addresses”:[“Via Giovanni Amendola, 5, 98071 Capo d’Orlando ME, Italy”],”origin_addresses”:[“Via Giovanni Amendola, 25, 98071 Capo d’Orlando ME, Italy”],”rows”:[{“elements”:[{“distance”:{“text”:”0.4 km“,”value”:395},”duration”:{“text”:”2 mins”,”value”:117},”status”:”OK”}]}],”status”:”OK”}
So if you add price 1 and divider 1, you should get 0.4EUR for the shipping. If you get any more than that, then check you don’t have any additional fees for your shipping.
Minimum and maximum values are used for limiting the shipping method’s visibility. You can set the minimum to 3km for example so the shipping method won’t show up until the distance from your shop to customers location is more than 3 kilometers.
However you can set up 2 or more shipping methods. One with the fixed fee for 3km distance. Minimum distance 0, maximum distance 3 and then set fixed fee for this shipping method.
Then add another shipping method where minimum distance is 3.1 and maximum distance is some large number, e.g. 9999. Then add the divider and fee as you wish and leave the fixed fee field empty.
Kim
I got your solution, thank you.
There is still one problem:
– I have a fixed fee of 1€ for all orders
– if distance is more than 3km BUT order has a minimum of 10€, then shipping fee will be 1€.
– if distance is more than 3km AND order is less than 10€, than shipping fee will be 1€ plus 0.30 * extra km.
– if distance is less or equal than 3km, shipping fee will be 1€ without a minimum amount.
I see that we have an option for “Hide if limits are exceeded”, I guess that to make it working like I said, we should have an option also to hide ONLY the distance fee rates if the minimum amount is reached.
There are hooks to manipulate the calculation formula, in case you need.
See the docs for more info: https://web-data.online/docs/woocommerce-custom-shipping-methods/#developers
Kim