We had the same issue with our store, unfortunately we couldn't make the change noted, because having the wordpress side-bars are essential to our site layout (they provide documentation, news, videos, and such that are essential to informing our customers), and making that change breaks the sidebars.*
Notably, I had no choice but to rapidly fix it, as most (about 70%) of our paypal express orders were failing for this reason.
I can't really tell you why _all_ of them don't fail, this is the part that has me completed confused.
(the following is related to paypalwpp.php)
Namely, the issue seems to be that when paypal returns the shipping address (and it always returns the shipping address, it seems), the variable $order is damaged in such a way that ec_step2() cannot populate the order info. This results in it finding that the override address does not match the order address (thinks it was changed at paypal), and since addAddressBookEntry() does not check if its a valid address, adds a blank address, and sets the sendto id to the blank address book entry.
Then, you know what happens when the final step goes back to paypal...
Here's what to look for in the logs to validate this:
Code:
Oct-04-2010 02:04:56 (1286157896)
ec_step2_finish - 1
START: paypal_ec_payer_info= Array
(
[payer_id] => xxxxxxxx
[payer_email] => useremail
[payer_salutation] =>
[payer_gender] =>
[payer_firstname] => Joe
[payer_lastname] => User
[payer_business] =>
[payer_status] => verified
[ship_country_code] => US
[ship_address_status] => Unconfirmed
[ship_phone] =>
[order_comment] =>
[ship_name] => Joe User
[ship_street_1] => 111 Fake Street
[ship_street_2] =>
[ship_city] => Houston
[ship_state] => TX
[ship_postal_code] => 77009
[ship_country_name] => United States
)
=================================
Oct-04-2010 02:04:56 (1286157896)
ec_step2_finish - 2
country_id = 223 United States US
address_format_id = 2
state_id = 57 (original state tested: TX)
country1->fields['countries_id'] = 223
country2->fields['countries_id'] = 223
$order->customer =
=================================
Oct-04-2010 02:04:56 (1286157896)
S2 1:
1
=================================
Oct-04-2010 02:04:56 (1286157896)
addAddressBookEntry - 1
address to add:
=================================
Oct-04-2010 02:04:56 (1286157896)
addAddressBookEntry - 2
added address #186
SESSION[sendto] is now set to 186
=================================
Oct-04-2010 02:04:56 (1286157896)
S2 2:
186
=================================
Now, the odd part for me was that findMatchingAddressEntry() validates its input data, so won't search for a blank address, but addAddressBookEntry() does not! This means every time a user encounters this issue, they add a new blank address to their book.
So, I added the following line to paypalwpp.php, just inside the addAddressBookEntry() function:
Code:
if ($address_question_arr['street_address'] == '') return false;
Additionally, I commented out the part that later tries to load the overridden address from the before_process() function:
Code:
/*
if ($order->delivery['street_address'] != $_SESSION['paypal_ec_payer_info']['ship_street_1'] && $_SESSION['paypal_ec_payer_info']['ship_street_1'] != '') {
$this->zcLog('compare addresses:', $order->delivery['street_address'] . ":" . $_SESSION['paypal_ec_payer_info']['ship_street_1']);
$_GET['markflow'] = 2;
if (($address_arr = $this->getOverrideAddress()) !== false) {
$this->zcLog('Forcing Override', print_r($address_arr, true));
// set the override var
$options['ADDROVERRIDE'] = 1;
// set the address info
$options['SHIPTONAME'] = $address_arr['entry_firstname'] . ' ' . $address_arr['entry_lastname'];
$options['SHIPTOSTREET'] = $address_arr['entry_street_address'];
if ($address_arr['entry_suburb'] != '') $options['SHIPTOSTREET2'] = $address_arr['entry_suburb'];
$options['SHIPTOCITY'] = $address_arr['entry_city'];
$options['SHIPTOZIP'] = $address_arr['entry_postcode'];
$options['SHIPTOSTATE'] = $address_arr['zone_code'];
$options['SHIPTOCOUNTRYCODE'] = $address_arr['countries_iso_code_2'];
}
}
*/
This means we'll never get in our cart the new address if a user changes it in paypal, but we just tell 'em to make sure they enter the right one in the shipping address.
We force logins to checkout, namely because each sell is fairly large, and we'll live with a slightly lower conversion rate, because ultimately drive-by's are just support nightmares for what we're selling.
I hope this helps someone else who needs to deal with WOZ and Paypal express!
* - of course, with this issue, we're going to have to hard-code the sidebars soon and only use WOZ when one of the pages is clicked on, I just needed to get everything working with minimal impact to the site until I can get some time to fix it all correctly.