Hey there. I have implemented a map using the Map JS API. It is not connected to Google Maps services and can render markers etc. Now i want to implement a store search, preferrably using the Store Locator JS API. In the documentation and all the examples i could find online it’s always required to use the google maps integration, but i lowkey hope this could work also with the default woosmap-map. So my question would be: Is it easily possible to search for stores with queries either using the Store Locator JS API (but without google maps), or maybe even with the Map JS API?
thx for your help
Hey @dominic, thanks for joining the Woosmap Community.
It’s a good question.
Yes you can do it through the Map JS API.
If you’re using the woosmap.map.StoresOverlay
to display your stores, you can implement the setQuery(query)
method.
let storesOverlay;
storesOverlay = new woosmap.map.StoresOverlay(style);
storesOverlay.setQuery('type:"click_and_collect"');
Your search query should match the Search API guidelines.
If you want to search nearby a position, the StoresOverlay
will not be sufficient. You will need to query the stores through a Search API call and process your response to add markers as you want.
Here is a more advanced example for doing this (check especially the sources of map component and stores api client):
Hey Gael, thank you for the quick and detailed response! I will fiddle around with the setQuery function, this should be sufficient for a simple usecase of finding stores in a city