Automattic\WooCommerce\Internal\Admin
SiteHealth::needs_maxmind_license_key
Determine whether MaxMind geolocation requires a license key.
Method of the class: SiteHealth{}
Hooks from the method
Returns
true|false.
Usage
// private - for code of main (parent) class only $result = $this->needs_maxmind_license_key();
SiteHealth::needs_maxmind_license_key() SiteHealth::needs maxmind license key code WC 11.0.0
private function needs_maxmind_license_key() {
/**
* Filter whether MaxMind geolocation notices should be displayed.
*
* Previously used to suppress the MaxMind license key admin notice. Honoured
* here so the equivalent Site Health warning can be suppressed the same way.
*
* @since 3.9.0
*
* @param bool $display Whether to display MaxMind geolocation notices.
*/
if ( ! apply_filters( 'woocommerce_maxmind_geolocation_display_notices', true ) ) {
return false;
}
$default_address = get_option( 'woocommerce_default_customer_address' );
if ( ! in_array( $default_address, array( DefaultCustomerAddress::GEOLOCATION, DefaultCustomerAddress::GEOLOCATION_AJAX ), true ) ) {
return false;
}
$integration_options = get_option( 'woocommerce_maxmind_geolocation_settings' );
return empty( $integration_options['license_key'] );
}