# Geolocation by specific country

**URL:** <https://community.gravityforms.com/t/geolocation-by-specific-country/19484>\
**Category:** Get Help\
**Tags:** geolocation\
**Created:** [June 12, 2025, 8:15am UTC](https://community.gravityforms.com/t/geolocation-by-specific-country/19484 "2025-06-12T08:15:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5c06e206625412.6](https://avatars.discourse-cdn.com/v4/letter/u/4bbf92/32.png) [@user5c06e206625412.6](https://community.gravityforms.com/u/user5c06e206625412.6)\
**Post date:** [June 12, 2025, 8:15am UTC](https://community.gravityforms.com/t/geolocation-by-specific-country/19484/1 "2025-06-12T08:15:43Z")

</div>

Hi all, I’m have the GeoLocation addon and working via Google Places API, I’m trying to limit address to South Africa only.

1. I’m Using Garvity forms Version 2.9.9
2. Geolocation by Gravity Forms - 1.5.0
3. Divi Builder

I have inserted the following code into the functions.php file right at the bottom. But it still is not working. Any pointer or advice will be appreciated.

function limit\_autocomplete\_to\_south\_africa( $options, $form\_id ) {  
if ( $form\_id == 8 ) {  
$options[‘componentRestrictions’] = array( ‘country’ =\> ‘za’ );  
}  
return $options;  
}  
add\_filter( ‘gform\_geolocation\_place\_autocomplete\_options’, ‘limit\_autocomplete\_to\_south\_africa’, 10, 2 );

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [June 12, 2025, 2:24pm UTC](https://community.gravityforms.com/t/geolocation-by-specific-country/19484/2 "2025-06-12T14:24:05Z")

</div>

gform\_geolocation\_place\_autocomplete\_options is a JavaScript filter, not a PHP filter. See the following page of the documentation for usage examples:

> **[gform\_geolocation\_place\_autocomplete\_element\_options](https://docs.gravityforms.com/gform_geolocation_place_autocomplete_element_options/)**
>
> Customize Google Place Autocomplete settings for address fields in Gravity Forms using this filter.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [July 12, 2025, 2:24pm UTC](https://community.gravityforms.com/t/geolocation-by-specific-country/19484/3 "2025-07-12T14:24:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
