Google Places Autocomplete limit to neighborhood


Staff member
I've successfully integrated the <a href="" rel="nofollow">Geocomplete jquery plugin</a> on a wordpress site. My issue is that I cannot limit the autosuggestion results to neighbourhood or sublocality. I've revised the Google Place types thoroughly but my results are always just the same. I know I'm doing something incorrectly somewhere. Here's what I have so far:

add_action( 'wp_head', 'add_geocomplete_script' );

function add_geocomplete_script() {
   &lt;script src=";libraries=places"&gt;&lt;/script&gt;
   &lt;script src="&lt;?php echo get_stylesheet_directory_uri() ?&gt;/js/jquery.geocomplete.js"&gt;&lt;/script&gt;
   &lt;script src="&lt;?php echo get_stylesheet_directory_uri() ?&gt;/js/logger.js"&gt;&lt;/script&gt;

function woocommerce_checkout_autocomplete(){
        jQuery(document).ready(function() {

            var options = {
                //types: ['(cities)'],
                //types: ['sublocality'],
                //componentTypes: ['neighborhood'],
                types: ["geocode", "sublocality"],
                country: 'za'


            jQuery("#billing_myfield8").on("keyup", function() {
                console.log('You typed in the input box');



add_action( 'wp_footer', 'woocommerce_checkout_autocomplete' );

With the above code I'm still able to search for an address, eg. 112 Nowhere Street. It doesn't filter the results.