Geolocating the user and redirecting


so my client sells these custom designed items, and he has one set of prices for the local market, and another for international. is there a way to route visitors according to their location to only show the appropriate content to the appropriate visitors?

i'm cool with even routing them to a different website entirely.

is there a way to do this?

  • Symi

    Whoohoo! Thanks Ash. :slight_smile:

    same functionality - but different application - this time with a wpmudev plugin...

    i have a tactical question. i'm installing appointments +.
    for guys who pay me for my appointments in my country, i need to charge at one rate,
    international folks pay another rate.
    it's not simply working the currency, the price needs to be different.

    once the system figures out someone is from X country, and i know they need to pay at RATE 1,
    how do i make that work with appointments + should i run a booking system for the one set of folks on one domain, maybe, and for other folks, on another domain's booking system?

    it's going to complicate things a little bit as i can then potentially be double booked unless i split the time?

    any ideas Ash?

    much gratitude on the geo plugin tho. i'm already using it for the first solution I was looking at for the client site. done and dusted!! you rock my world.

  • Ash

    Hello @Symi

    If you are using this plugin ( ) then I have found a solution for you.

    Please use the following code:

    add_filter( 'app_get_price_prepare', 'app_get_price_prepare_cb', 99, 3 );
    function app_get_price_prepare_cb( $price, $paypal, $obj ) {
    	$geo = new Geo_Redirect();
    	// Assume XX is your country code
    	if( $geo->getCountryCode() == 'XX')
    		return 5; // Price for your country
    		return 10; // International Price

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.