WordPress at Your Fingertips
function is not described

WC_Integration_MaxMind_Geolocation::get_geolocation() public WC 1.0

Performs a geolocation lookup against the MaxMind database for the given IP address.

{} It's a method of the class: WC_Integration_MaxMind_Geolocation{}

No Hooks.

Return

Array. Geolocation including country code, state, city and postcode based on an IP address.

Usage

$WC_Integration_MaxMind_Geolocation = new WC_Integration_MaxMind_Geolocation();
$WC_Integration_MaxMind_Geolocation->get_geolocation( $data, $ip_address );
$data(array) (required)
Geolocation data.
$ip_address(string) (required)
The IP address to geolocate.

Code of WC_Integration_MaxMind_Geolocation::get_geolocation() WC 5.9.0

public function get_geolocation( $data, $ip_address ) {
	// WooCommerce look for headers first, and at this moment could be just enough.
	if ( ! empty( $data['country'] ) ) {
		return $data;
	}

	if ( empty( $ip_address ) ) {
		return $data;
	}

	$country_code = $this->database_service->get_iso_country_code_for_ip( $ip_address );

	return array(
		'country'  => $country_code,
		'state'    => '',
		'city'     => '',
		'postcode' => '',
	);
}