Hi,
It would be useful to be able to query the delivery area a customer is in using BrewwQL.
Currently, as a workaround, we assign the relevant static delivery area tag to each customer. But this is time-consuming, prone to mistakes, and is difficult to scale.
Thanks for the suggestion, Michael. I can see how this would be useful.
The difficulty here (and why this isn’t already an option) is that a customer can fit into multiple delivery areas (you can draw overlapping areas). There might well be a good solution to this that we can implement, but I wanted to give you some background on why this is not there already
It’s not as simple as it sounds as we also never store that a customer is part of a delivery area and for performance reasons BrewwQL filters can only interact with “stored” data.
Currently, each time we need to know if a customer is in a delivery area, we work it out at the time. Doing this for all customers on all queries would be too slow.
So yes, we could use a similar approach as we have with tags, but we’d first need to start to store which customers were in which areas and ensure that every time a customer’s address was updated we checked all delivery areas, and every time a delivery area was updated we checked all customer accounts to see if they matched the new area.
All of this means that what feels like a simple request on the surface is actually far more substantial than it looks. Keep the votes coming though and let’s get it moved up the priority list