After talking with David further, the following is the official fix, to be included in future updates:
In savedbookactions.php, the following code was added directly underneath “$amazondetpage = filter_var($saved_book->amazondetailpage, FILTER_SANITIZE_URL);”
// Following code is to direct visitors to the UK amazon if they’re in the UK, based off their IP
// Getting user’s ip
$ip;
if (!empty($_SERVER[‘HTTP_CLIENT_IP’])) {
$ip = $_SERVER[‘HTTP_CLIENT_IP’];
} elseif (! empty($_SERVER[‘HTTP_X_FORWARDED_FOR’]))
{
$ip = $_SERVER[‘HTTP_X_FORWARDED_FOR’];
} else {
$ip = $_SERVER[‘REMOTE_ADDR’];
}
// Getting country based on ip
$xml = simplexml_load_file(“https://www.geoplugin.net/xml.gp?ip=”.$ip);
// Checking to see if the user’s site is in UK
$visitor_country = $xml->geoplugin_countryName;
if ($visitor_country == ‘United Kingdom’) {
$amazondetpage = str_replace(“.com”,”.co.uk”, $amazondetpage);
}