Implementing Distance-Based Shipping Fees on Wix

Hello,
A restaurant owner client of mine is requesting to charge for online orders based on distance.

For example, while all orders up to 10km have free shipping, they want to set shipping fees like $10 for up to 15km, $15 for up to 20km. I wonder how this can be done on Wix’s side?

You can do custom shipping rates with this SPI: Introduction - Velo SPI Reference - Wix.com

You’d have to use a function to first calculate distance between two addresses. And then use the spi shipping rates to present the option to the customer.