I somewhat think that this is more than an issue with USPS based on the testing that I also have now performed. It's not easy to reproduce, but I was able to do so moving forwards and backwards through the process.
It looks like what could happen and similar to this situation, is that when a price is first presented, the lowest price is provided/selected. When the destination address is changed, (and in this case results in a higher priced shipping method to be available) there is nothing that resets the shipping method and as a result, there is already a shipping method identified and therefore the lowest price is not again sought/reset. After a little navigation around with the browser, it could be possible to still have the previously existing (though no longer correct) shipping method active/selected and therefore the incorrect price applied.
I would suggest the following code change in includes/modules/pages/checkout_shipping/header_php.php:
Find:
Code:
// check that the currently selected shipping method is still valid (in case a zone restriction has disabled it, etc)
if (isset($_SESSION['shipping'])) {
$checklist = array();
foreach ($quotes as $key=>$val) {
if ($val['methods'] != '') {
foreach($val['methods'] as $key2=>$method) {
$checklist[] = $val['id'] . '_' . $method['id'];
}
} else {
// skip
}
}
$checkval = $_SESSION['shipping']['id'];
if (!in_array($checkval, $checklist)) {
$messageStack->add('checkout_shipping', ERROR_PLEASE_RESELECT_SHIPPING_METHOD, 'error');
}
}
and add the below one line:
Code:
// check that the currently selected shipping method is still valid (in case a zone restriction has disabled it, etc)
if (isset($_SESSION['shipping'])) {
$checklist = array();
foreach ($quotes as $key=>$val) {
if ($val['methods'] != '') {
foreach($val['methods'] as $key2=>$method) {
$checklist[] = $val['id'] . '_' . $method['id'];
}
} else {
// skip
}
}
$checkval = $_SESSION['shipping']['id'];
if (!in_array($checkval, $checklist)) {
$messageStack->add('checkout_shipping', ERROR_PLEASE_RESELECT_SHIPPING_METHOD, 'error');
unset($_SESSION['shipping']);
}
}
Now this will mean that if one were to change addresses to eventually return to the original address that the selection would again be the lowest price and not perhaps a slightly higher priced, perhaps more desirable selection. But at least this way the chosen shipping selection would align with the destination.
Bookmarks