Restricting Search Function to multiple countries

New home Forums Pro Add-on General queries Restricting Search Function to multiple countries

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #35999
    s.axel1
    Member

    Hello,

    in our pro version we would like to restrict search function to multiple countries like DE, FR, LU, CH, AT, BE, NL, LI, MC, .

    Is there an override e.g. like below? Or can you set it up for a future Pro Version?

    Kind regards Axel

    https://www.wpgmaps.com/forums/topic/restricting-search-function-to-one-country/

    Pro version
    Please open wp-google-maps-pro/js/core.js and search for the following code (around line 1557):

    geocoder.geocode({address: address}, function(results, status) {

    Change that to:

    geocoder.geocode ({ ‘address’: wpgm_address,componentRestrictions: {country: ‘DE’} }, function(results, status) {

    #36183

    Hi Axel,

    My sincere apologies for the delay in response over the long weekend.

    To restrict it to multiple countries, please change the following code:

    geocoder.geocode ({ ‘address’: wpgm_address,componentRestrictions: {country: ‘DE’} }, function(results, status) {

    To this:
    geocoder.geocode ({ ‘address’: wpgm_address,componentRestrictions: {country: [“DE”, “FR”, “LU”, “CH”, “AT”]} }, function(results, status) {

    This should work correctly. Please let me know if this helps and if you come right with it.

    Kind regards,
    Dylan

    #36214
    s.axel1
    Member
    This reply has been marked as private.
    #36412

    Hi Axel,

    Sorry for the delay in response over the weekend.

    Unfortunately, there was an error with the file being uploaded.

    Could I kindly ask if you could send it to my email address [email protected] so that I can take a closer look and assist you further?

    Kind regards,
    Dylan

    #36426
    s.axel1
    Member
    This reply has been marked as private.
    #36428
    s.axel1
    Member

    Hi Dylan,

    this was before the update I think?

    Best Regards Axel

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.