Index: location.module
===================================================================
--- location.module	(revision 1583)
+++ location.module	(working copy)
@@ -865,6 +865,7 @@ function _location_autocomplete($country
   $string   = strtolower($string);
   $string   = '/^'. $string .'/';
   $matches  = array();
+  $codesonly = variable_get('location_province_autocomplete', 0);
 
   if (strpos($country, ',') !== FALSE) {
     // Multiple countries specified.
@@ -881,9 +882,17 @@ function _location_autocomplete($country
   if (!empty($provinces)) {
     while (list($code, $name) = each($provinces)) {
       if ($counter < 5) {
-        if (preg_match($string, strtolower($name))) {
-          $matches[$name] = $name;
-          ++$counter;
+        if ($codesonly) {
+          if (preg_match($string, strtolower($code))) {
+            $matches[$code] = $code;
+            ++$counter;
+          }
+        }
+        else {
+          if (preg_match($string, strtolower($name))) {
+            $matches[$name] = $name;
+            ++$counter;
+          }
         }
       }
     }
