woocommerce_geolocate_ip хук-фильтрWC 3.9.0

Filter to allow custom geolocation of the IP address.

Использование

add_filter( 'woocommerce_geolocate_ip', 'wp_kama_woocommerce_geolocate_ip_filter', 10, 4 );

/**
 * Function for `woocommerce_geolocate_ip` filter-hook.
 * 
 * @param string $geolocation  Country code.
 * @param string $ip_address   IP Address.
 * @param bool   $fallback     If true, fallbacks to alternative IP detection (can be slower).
 * @param bool   $api_fallback If true, uses geolocation APIs if the database file doesn't exist (can be slower).
 *
 * @return string
 */
function wp_kama_woocommerce_geolocate_ip_filter( $geolocation, $ip_address, $fallback, $api_fallback ){

	// filter...
	return $geolocation;
}
$geolocation(строка)
Country code.
$ip_address(строка)
IP Address.
$fallback(true|false)
If true, fallbacks to alternative IP detection (can be slower).
$api_fallback(true|false)
If true, uses geolocation APIs if the database file doesn't exist (can be slower).

Список изменений

С версии 3.9.0 Введена.

Где вызывается хук

WC_Geolocation::geolocate_ip()
woocommerce_geolocate_ip
woocommerce/includes/class-wc-geolocation.php 159
$country_code = apply_filters( 'woocommerce_geolocate_ip', false, $ip_address, $fallback, $api_fallback );

Где используется хук в WooCommerce

Использование не найдено.