Fix Undefined index: SHIPTOSTATE Error in ISC

Problem

PHP Notice when “SHIPTOSTATE” is not available in PayPal Express Checkout.

Undefined index: SHIPTOSTATE in /home/moddiy/public_html/modules/checkout/paypalexpress/module.paypalexpress.php at 423

Solution

In /modules/checkout/paypalexpress/module.paypalexpress.php (line 423)

Find

$stateID = $this->GetStateId($countryID, $nvpArray['SHIPTOSTATE']);
$stateName = GetStateById($stateID);

Replace

//=============================================
// MOD START
// Fix "Undefined index: SHIPTOSTATE" error
//=============================================
//$stateID = $this->GetStateId($countryID, $nvpArray['SHIPTOSTATE']);
//$stateName = GetStateById($stateID);
if(isset($nvpArray['SHIPTOSTATE'])) {
	$stateID = $this->GetStateId($countryID, $nvpArray['SHIPTOSTATE']);
	$stateName = GetStateById($stateID);
}else{
	$stateID = '';
	$stateName = '';
}
//=============================================
// MOD END
//=============================================

Leave a Reply

Your email address will not be published. Required fields are marked *