Geolocation API not working on created attributes/fields whenever shifting categories

Hi,

I have a parent category called “Carpooling” and 2 child categories “Offering ride” and “Request ride”.

I am trying to add an “end location” field that will run Locations API. This field will recommend auto-generated locations within a restricted area.
Apparently, this “end location” field is not existing under “Request ride”.

Whenever I shift to the “Request ride” child category (end location field is hidden) and back to “Offering ride” (end location field is showing), the field does not show auto-generated addresses/locations anymore whenever I type on that field.

Hi,

Please provide more details. Did you create a custom field and apply our Geolocation to it to add another location field? Or do you mean the existing built-in Location field?

Hi Andrii,

We added an attribute in our listing with type text applied our own geolocation to it. Is there a way where we can apply your geolocation to that field? If yes, how can we possibly apply that to a custom field/added attribute that we have?

Hi,

I recommend you take a look at GitHub to see how the Geolocation extension is built: GitHub - hivepress/hivepress-geolocation: Geolocation extension for HivePress plugin.
Or, you can view these fields through the Dev tools panel; there are three of them, location, latitude, and longitude, and in location data-component="location". Also, if you have your own geolocation, then you need to attach the initialization to the hivepress:init event, then after reloading the JS form, the fields will also be updated.

​I hope this is helpful to you.

Hi Andrii,

Is there a way where we can implement the google.maps.places.Autocomplete into a custom field? For example, I will create an attribute for a listing called “Location 2”, is there a way to implement the autocomplete functionality in this field?

1 Like