SDK/Theme Update: Support for distanceFromFilter

We’ve added a new field called distanceFromFilter that returns a location’s distance from the currently selected filter.

For example, say you conduct a query for “Yext office near Arlington, VA”, and you’re currently located in downtown DC:

By default, the location-style cards will display the distance from the Yext office to the detected location of the user, in this case, downtown DC (the blue line). Instead, if you want to display the distance from the office to the detected filter in the query (Arlington, VA), then you can fork the card and add an optional parameter to the formatter, like this: Formatter.toMiles(profile, ‘d_distanceFromFilter’) (this will result in the red line).

1 Like

Thanks for this old post Liz, this helped me solve an issue today!

If anyone wants to have kilometers instead of miles it is distance: Formatter.toKilometers(profile, 'd_distanceFromFilter'), :slight_smile: