Show price with Geo IP location

Here is a simple approach to achieve what you are trying.

Put these functions in your theme’s functions.php or plugin file.

This will let you capture 2-letter country code with API request. You have to test it remotely (if you test on localhost you’ll get no country code as your IP reads as 127.0.0.1, so you have to test with real IP )

Functions

// This function will retrieve the current user IP
// needed to query the geo country
function _wp_get_ip() {
    $ip = '127.0.0.1';

    if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
        //check ip from share internet
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
        //to check ip is pass from proxy
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } elseif( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
        $ip = $_SERVER['REMOTE_ADDR'];
    }

    $ip_array = explode( ',', $ip );
    $ip_array = array_map( 'trim', $ip_array );

    if ( $ip_array[0] == '::1' ) {
        $ip_array[0] = '127.0.0.1';
    }

    return $ip_array[0];
}

// get the country code XX 
// will return null/empty if any error
function _wp_get_country_code() {

    $response = wp_remote_get( 'http://ipinfo.io/' . _wp_get_ip() . '/country' );
    if ( strlen( $country_code = (string) trim( $response['body'] ) ) == 2 ) {
        return $country_code;   
    }

    return '';
}

Conditional Price

Now you can run your conditional price output as following:

$country_code = _wp_get_country_code();

if ( $country_code == 'US' ) {

} else if ( $country_code == 'UK' ) {

} else {

    // etc...

}

Please note

This can be improved furthermore and be more efficient if you implement caching. But this is somewhat advanced for what is being asked here. I am just letting you that’s not the best way to do it if you have a lot of users.