Hello,
we’re working on an app that calculates the distance between the shipping origin and the buyer’s address to propose a dynamic shipping rate.
When we receive a request from the Carrier Service API, we get the address data in the fields rate.origin and rate.destination.
We observe that in the origin object the coordinates (latitude / longitude) are provided correctly — but in destination, when the address is entered during checkout, these values are null.
Interestingly, when the customer is logged in and uses a saved address — the coordinate fields are filled correctly.
In the official documentation of the Carrier Service resource (both REST Admin API and GraphQL Admin API) I didn’t find any guarantee that geolocation (latitude/longitude) of addresses is included for origin/destination.
-
REST Admin API: CarrierService
-
GraphQL Admin API: DeliveryCarrierService - GraphQL Admin
Moreover — although in the changelog for Carrier Service API there was an announcement about adding new fields like order_totals and “customer tags” to the callback payload (see Carrier Service API now includes order totals and customer tags - Shopify developer changelog ) — these changes also were not reflected in the documentation - Carrier Service and new order_totals field
In our case, missing geolocation data for destination forces us to perform an additional external geocoding API request each time to obtain the buyer’s coordinates — so we can calculate the distance.
This significantly slows down the response and makes it hard to comply with the performance requirements of Carrier Service API callback (fast response time, high reliability).
Therefore my question: is it possible that Shopify starts providing coordinates (latitude, longitude) for the destination address in every case (checkout, guest, saved address)?
That would allow us to avoid additional external API calls and greatly improve performance and predictability of our app.
Thanks in advance for any clarifications.