Tintef / react-google-places-autocomplete

React Google Places Autocomplete input -- fully customizable
https://tintef.github.io/react-google-places-autocomplete
MIT License
376 stars 161 forks source link

Get full country name and country code #324

Open redimongo opened 1 year ago

redimongo commented 1 year ago

I am trying to get the full address including the country code and country name.

I am noticing for example that United States of America is being printed in it's short form USA which technically is correct, however the country code for USA is US.

Is there anyway to solve this?

Another example is Australia addresses get the word Australia at the end which we can match to our Countries json file

We can't match USA (while technically we can, it's not the right way to go around it)

Tintef commented 2 months ago

@redimongo where you able to solve this?

redimongo commented 2 months ago

@redimongo where you able to solve this?

I can't see that we did solve it, what we did was work around it, so it was for our billing system where a client typed in their address and when would show them the billing in their local currency, so what we did was have a util script that would run when the address was changed. That sent the country name to our system that then got the short code, which then loaded the package in the users currency.

It's not the best way, but it was away around this small limitation.