• Resolved alx359

    (@alx359)


    Terrific plugin! ??

    Have a small issue with google autocomplete. The addresses suggested by google aren’t populating the State/County or also called Province dropdown. For example: https://postimg.cc/N5YQTKzc

    Is it possible to fix this with some extra code snippet or configuration?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Uriahs Victor

    (@uriahs-victor)

    Hi, unfortunately right now the fields are being populated with the standard administration levels returned by the Google API, but I do know that for some countries this is different, example India has a “Pin Code” field which WooCommerce knows about but currently is not being filled in by the plugin. I plan to at some point allow users to choose which administration fields go where, but still brainstorming how best to go about this.

    Can you please try temporarily turning off Fluid Checkout and test again to see if the issue is with it? It does some things differently that I had to cater for while adding support for it.

    Let me know

    Thread Starter alx359

    (@alx359)

    Hi @uriahs-victor,

    Turned off Fluid Checkout (FC) and got an error in the FF JS console. Then turned off everything else to debug mode (i.e. 2022 theme, all plugins off but WC and LP) and got the same error:

    Uncaught ReferenceError: mapOptions is not defined
        <anonymous> /plugins/map-location-picker-at-checkout-for-woocommerce/assets/public/js/maps/build/checkout-page-map.js?ver=1.5.7:1
        jQuery 13
    checkout-page-map.js:1:16000

    The auto-fill doesn’t work in the std. checkout because of this. Interestingly, there’s no error and it does work with FC.

    Update 1:

    Think found the culprit. The error happens when the Where Should the Map Appear on the Checkout Page? setting isn’t properly configured (i.e. just select). Switching from FC to standard form resets this dropdown, but the lack of value isn’t handled well.

    Update 2:

    To your original question: no, when FC is disabled (and every thing else but WC and LP), the State / County isn’t getting automatically populated for me either: https://postimg.cc/QV8ptMfG

    Plugin Author Uriahs Victor

    (@uriahs-victor)

    Hi, thank you, I have logged the bug regarding the map location and will fix it in a future version of the plugin. Regarding the state/county issue, this one is a bit more involved to fix because it might be the country of Bulgaria returning different administration levels that the plugin can’t currently handle, but I have logged it as well and will try to find a way to fix this for all users in countries with varying administration levels instead of just changing this for Bulgaria alone…

    I’m going to close this thread now as its something I already have in the roadmap but feel free to reach out in the future for an update on the progress.

    Not working on my end either: https://imgur.com/a/Ka8orgt

    It just populates the ZIP Code. I know Google Places return funky values for their API, sometimes it works, sometimes it doesn’t. For instance, on this request, this is the Places Response

    /**/_xdc_._hegq57 && _xdc_._hegq57( {
       "html_attributions" : [],
       "result" : {
          "address_components" : [
             {
                "long_name" : "1290",
                "short_name" : "1290",
                "types" : [ "street_number" ]
             },
             {
                "long_name" : "Rua Jandiroba",
                "short_name" : "R. Jandiroba",
                "types" : [ "route" ]
             },
             {
                "long_name" : "Patamares",
                "short_name" : "Patamares",
                "types" : [ "sublocality_level_1", "sublocality", "political" ]
             },
             {
                "long_name" : "Salvador",
                "short_name" : "Salvador",
                "types" : [ "administrative_area_level_2", "political" ]
             },
             {
                "long_name" : "Bahia",
                "short_name" : "BA",
                "types" : [ "administrative_area_level_1", "political" ]
             },
             {
                "long_name" : "Brasil",
                "short_name" : "BR",
                "types" : [ "country", "political" ]
             },
             {
                "long_name" : "41680-040",
                "short_name" : "41680-040",
                "types" : [ "postal_code" ]
             }
          ],
          "formatted_address" : "R. Jandiroba, 1290 - Patamares, Salvador - BA, 41680-040, Brasil",
          "geometry" : {
             "location" : {
                "lat" : -12.9532368,
                "lng" : -38.4066948
             },
             "viewport" : {
                "northeast" : {
                   "lat" : -12.9519433697085,
                   "lng" : -38.4053713697085
                },
                "southwest" : {
                   "lat" : -12.9546413302915,
                   "lng" : -38.4080693302915
                }
             }
          }
       },
       "status" : "OK"
    }
     )

    It’s not a trivial task, but if you allow each developer to input their data for their location, maybe in time you can build something that works? I have no ideia how Shopify manages to get it right every damn time.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘autocomplete not populating state/county’ is closed to new replies.