I have made some progress and thought I would share it so you can add your opinions or advice.
If I change the code at round line 1917 of my includes/modules/payment/paypalwpp.php file from:
Code:
$_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
// This is the address matching section
// try to match it first
// note: this is by no means 100%
$address_book_id = $this->findMatchingAddressBookEntry($_SESSION['customer_id'], $order->delivery);
// no match, so add the record
if (!$address_book_id) {
$address_book_id = $this->addAddressBookEntry($_SESSION['customer_id'], $order->delivery, false);
}
// set the address for use
$_SESSION['sendto'] = $address_book_id;
to this:
Code:
if(!isset($_SESSION['sendto']) || $_SESSION['sendto'] == ''){
$_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
// This is the address matching section
// try to match it first
// note: this is by no means 100%
$address_book_id = $this->findMatchingAddressBookEntry($_SESSION['customer_id'], $order->delivery);
// no match, so add the record
if (!$address_book_id) {
$address_book_id = $this->addAddressBookEntry($_SESSION['customer_id'], $order->delivery, false);
}
// set the address for use
$_SESSION['sendto'] = $address_book_id;
}
then the address is added to the order correctly in the scenario we are having trouble with. I just added the first IF statement. The only problem that doing this creates (that I have found so far) is that if the customer changes their address on the PayPal screen it does not get added to the order.
What this means is that as long as the customer chooses the same shipping address during checkout as they do on the PayPal screens (if they change it) then we have a workaround
If someone could take a look and see what other implications this may have I would appreciate it. Also if there is a way to change my IF statement to allow the code to execute when the address is changed on the PayPal screens then this would work perfectly.
Any ideas?
Bookmarks