Hello, im developing a carrier service app for local deliveries (15km distance max).
I have the problem that when shopify choose the origin location which it consider the "best one", it may be out of range for my carrier service.
I can see that it choose the location according with if it have stock or not of not of a given product. And, if i buy different items that are only available in different stores, it create correctly all the fulfillment orders. That works great.
How ever the problem comes in when for example, i buy a item which have stock in more than one location. In this case shopify choose the location that is set as default in the config.
When this happens, and request for the shipping rates to my callback URL, in some cases the location is out of range of the delivery service BUT there are other locations which are inside my working range and this logic is not considering it.
Further more if i have 2 locations in 2 diferent cities and stock in both locations, it choose the 'default location' as origin location even if its in another city!
I upload an image to be more clear:
In this example it choose the location 1. Just because both of them have stock and don't consider the distance to the destination (not even meters, cities or postal codes).
This isn't something that's available today but I like the concept of having a distance to customer type calculation in determining the location to fulfill an order. I've logged this as an enhancement request but of-course can't commit if this will ever be implemented.
The only alternative I could think of is attempting to implement some distance logic calculation in your Carrier Service endpoint. The downside, while you would have access to the locations of the merchant, and inventory levels for the given item I would be concerned about this additional logic being completed in the time lines we allow for you to return a response. Also, the resulting order would still default to fulfillment from the default location as you've demonstrated that the merchant would need to know to change to the closer location when the order is fulfilled.
All that to say unfortunately at this time there's not a nice way to solve this.