Folks,
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?
Thanks!
Sri
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:
http://jsfiddle.net/1dd3ss5p/2/
https://jsfiddle.net/upsidown/1svw299r/
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.
Sri
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!
The topic ‘WooCommerce Geolocation’ is closed to new replies.
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 use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.