Apologies in advance if this has been asked/answered before. I did search but couldn’t find anything with regards to the query I have.
Question: Would it be possible to use the Google Map field to add a “location” field in WooCommerce? If so, could this field be then used by users when searching for products, say within a location?
Does that make sense?
You can add a map field on products of course. The other part depends on google api and theme coding in order to create a search input to find on your “locations”. You need to be more specific on what is locations in this case. Something you add as a metadata to the map, like a name or title? Or by ID, or by product name…? could be many things if i started to think into this.
You may take a look into this things i guess:
Both has a finder, but they are searching for diferent things.
Hi @rgdesign, thanks for getting back to me.
Sorry if I wasn’t very clear. The use case scenario is a product rentals site. The location will be one of the fields entered by the person putting their product up for rent, as in, the location (city, state, zip/post code) of the product they want to rent. This field will not be publicly visible BUT users who are looking for products will be able search by location.
For example, I added a product with location City, State, zip/post code. Now, if users are searching for a product and selected the City and/or State or zip, I would want the product I entered to show up.
This is the screenshot of the gumtree.com.au home page. This is basically what I am trying to accomplish. Dropbox Link
Thanks again for your help.
I made something similar here: http://orihuelainmobiliaria.com/
The map render markers that are in fact the results on the right. The api has also a clustered extencion to group markers if are closer and zoom makes them to be visible overlaped (many listings sites uses this technique)
I see on your design that you need something related to how “close” will be the location, the 0km – 500km selector. That´s something you can´t do only on php and js on the theme, this needs to be filtered once the map is rendered since will be a second search right on the map api.
The rest, the first filter, input and location, that is something you can do using a custom query with multimple meta post. That´s is those custom fields with City, State, zip/post code and the map coordinates (acf fields yes)
Your request is too particular, i don´t know (and have no time), how to explain this in more detail. Will be too long also, we are talking about all sides, php, js, ajax, custom query results, google api… Everything is documented, in fact i learned how to do that looking for on many resources and then mixing the things.
Sorry I never took the time to thank you for replying 🙂 The project has left my hands so all good for now!
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.