Thanks in advance for your support! I’ve spent quite a lot of time in bubble, yet I feel like I’m making a simple error that I just can’t resolve.
I am creating a food marketplace similar to doordash, that I am launching in 3 days, but encountered a problem that I need to solve by using the Google Distance Matrix API.
I am trying to display “restaurants” in a repeating group. I only want to display “restaurants” that are within a certain driving distance to the customer’s delivery address (using the Google Distance Matrix Plugin).
To calculate the distance between 2 points using the plugin you simply choose: dynamic data - Google Matrix API - input origin address & destination address.
The problem arises when I try to set the constraints in the search for “restaurants”.
“Distance Max in km” is a value set by the restaurant to specify how far they want to deliver. So I set that to ≤ the calculated distance value.
When I try to calculate the distance from “customer’s address” (=SearchBox Address complete’s value) to “restaurants address”, I cannot find the dynamic data option for “restaurant’s address”.
I think I may have a solution for you using the built in distance function. You will need Google Geocode API key. I have not been able to test this but it may give you an inspiration.
a filter always happens after the search, so try to see if you can do it inside the search itself. Make sure you use the less than or equal operator ( <= ) , instead of less than.
Do you guys also have an idea how to decrease API requests to google? To make a rough calculation: like this if I have for example 1000 restaurants on the marketplace each user’s search means 1000 requests = around 8€
I was thinking about grouping the addresses to addresses near them or to only search for restaurants that ship to specific ZIP codes (also needs to be specified in advance by restaurant owner…)