Skip to content

Commit 7d14b85

Browse files
authored
Allow USPS Shipping Methods Without ExtraServices
According to the USPS API `<ExtraServices>` can show up as an empty element, like so: `<ExtraServices/>`. In fact, this is causing an issue with "Priority Mail International" shipments to the UK, because USPS doesn't offer any extra services for that shipping method. They do however add extra services to Priority Mail International packages sent to AU.
1 parent 732d445 commit 7d14b85

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/code/Magento/Usps/Model/Carrier.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,6 +2060,11 @@ protected function _parseZip($zipString, $returnFull = false)
20602060
*/
20612061
private function isServiceAvailable(\SimpleXMLElement $service)
20622062
{
2063+
// Allow services which which don't provide any ExtraServices
2064+
if(empty($service->ExtraServices->children()->count())) {
2065+
return true;
2066+
}
2067+
20632068
foreach ($service->ExtraServices->children() as $child) {
20642069
if (filter_var($child->Available, FILTER_VALIDATE_BOOLEAN)) {
20652070
return true;

0 commit comments

Comments
 (0)