kask
kask

Reputation: 1759

Algolia Search Facet geolocation

We are running a Magento Shop and we want to display products in the customers region. How can we achive this as a facet, like price range? Only that we take the distance as a range.

For a logged in customer we could use the customer-address as a reference point. For guests we could use the IP as a fallback.

Upvotes: 3

Views: 437

Answers (1)

redox
redox

Reputation: 2319

If your records are geo-localized (have a _geoloc: { lat: XXX, lng: YYY} attribute; yes you can definitely use the geo-search feature to restrict the search to results that are "close to them" (using aroundRadius and aroundLatLngViaIP for instance).

That being said, maybe you want more control/precision -> so if you are able to filter the results based on a facet value, it would work as well. You'll need to enforce the filter on the underlying AlgoliaSearchHelper in the JS code using addFacetRefinement.

Upvotes: 2

Related Questions