I need to calculate distance in km to add to a flat rate, on checkout page when user click on address to put their address I got lil script that pops up on a modal user enter their location and the script(is a html script where i use Places Search Box from google) it works fine, but once i have the fee based on distance, I don't know how to update the shipping rate with the amount i have.
this is done by the frontend, not backend, how can i get this variable data to the backend and use it to update the shipping rate.
as you can see in the image, i calculated the distance, how can now i change or update the flat rate with $6.47,
I cannot use plugins that's why it must be with some snippet
