I found a problem before when I was trying to using Cart66 wordpress plugin in Singapore. The extremely strange thing is the IP in Singapore will be changed frequently. Normally it is well know the IP will not be changed until restart the modem. But it is true this strange problem will happens in some countries.
So the best solution is to disable the IP validation function in this plugin.
Tags: cart-empties-after-clicking-check-out cart-is-empty
Here is the method:
1) Edit the file [Wordpress installation folder]/wp-content/plugins/cart66-lite/models/Cart66Session.php
2) Find the code as below.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
protected static function _isValid($data) {
$isValid = true;
if($data['ip_address'] != self::_getIp()) {
$isValid = false;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Session is not valid - IP Address changed");
}
elseif($data['user_agent'] != $_SERVER['HTTP_USER_AGENT']) {
$isValid = false;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Session is not valid - User agent changed");
}
elseif(!self::_isActive($data)) {
$isValid = false;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Session is not valid - Expired");
}
return $isValid;
} |
3) And replace them by the code below here.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
protected static function _isValid($data) {
$isValid = true;
/*if($data['ip_address'] != self::_getIp()) {
$isValid = false;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Session is not valid - IP Address changed");
}
else*/
if($data['user_agent'] != $_SERVER['HTTP_USER_AGENT']) {
$isValid = false;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Session is not valid - User agent changed");
}
elseif(!self::_isActive($data)) {
$isValid = false;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Session is not valid - Expired");
}
return $isValid;
} |
4) That’s all. Enjoy xD.