woocommerce_get_geolocation
Get geolocation filter.
Использование
add_filter( 'woocommerce_get_geolocation', 'wp_kama_woocommerce_get_geolocation_filter', 10, 2 ); /** * Function for `woocommerce_get_geolocation` filter-hook. * * @param array $geolocation Geolocation data, including country, state, city, and postcode. * @param string $ip_address IP Address. * * @return array */ function wp_kama_woocommerce_get_geolocation_filter( $geolocation, $ip_address ){ // filter... return $geolocation; }
- $geolocation(массив)
- Geolocation data, including country, state, city, and postcode.
- $ip_address(строка)
- IP Address.
Список изменений
С версии 3.9.0 | Введена. |
Где вызывается хук
woocommerce_get_geolocation
woocommerce/includes/class-wc-geolocation.php 182-191
$geolocation = apply_filters( 'woocommerce_get_geolocation', array( 'country' => $country_code, 'state' => '', 'city' => '', 'postcode' => '', ), $ip_address );
Где используется хук в WooCommerce
woocommerce/includes/integrations/maxmind-geolocation/class-wc-integration-maxmind-geolocation.php 83
add_filter( 'woocommerce_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 );