$country_code = isset($data->country_code) ? $data->country_code : ''; break; default: $country_code = apply_filters('woocommerce_geolocation_geoip_response_' . $service_name, '', $response['body']); break; } $country_code = sanitize_text_field(strtoupper($country_code)); if ($country_code) { break; } } } set_transient('geoip_' . $ip_address, $country_code, WEEK_IN_SECONDS); } return $country_code; } /** * Test if is IPv6 * * @since 2.4.0 * * @param string $ip_address * @return bool */ private static function is_IPv6($ip_address) { return false !== filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); } } WC_Geolocation::init();