/** * Get a hash of the customer location. * @return string */ public static function geolocation_ajax_get_location_hash() { $customer = new WC_Customer(); $location = array(); $location['country'] = $customer->get_country(); $location['state'] = $customer->get_state(); $location['postcode'] = $customer->get_postcode(); $location['city'] = $customer->get_city(); return substr(md5(implode('', $location)), 0, 12); }