Tag Archives: USPS shipping error

USPS Shipping Error for USA to Canada Shipping

An unexpected USPS shipping error occurred to most Magento stores in the USA who are using the USPS Magento module in their shipping methods to ship to Canadian customers. This error caused some confusion for both us and our clients during the last two weeks.

Normally, USPS has three options in their service, including (1) First-Class Package International Service, (2) Priority Mail International and (3) Priority Mail Express International, but the problem only happened to the second one “Priority Mail International”. This option suddenly disappeared from the estimate shipping column so that shoppers couldn’t choose this shipping method during their check out process.

USPS shipping error 2

More dangerously, the error sometimes turned the “Priority Mail International” option into an empty label option at a price $0.00 for Canadian orders. This means that our clients had to provide a free shipping service, or contact the shopper to redeem the correct postage value causing considerable inconvenience.

USPS shipping error 1

Here is what we detected after checking the file log: The Origin ZIP Code was absent.

<ServiceErrors><ServiceError><Id>50050</Id><Description>The Origin ZIP Code and the Destination Postal Code is required for Priority Mail International when mailing to Canada.</Description></ServiceError></ServiceErrors>

And this is our solution: The Origin ZIP Code injected. We added in line 394 file app/code/local/Mage/Usa/Model/Shipping/Carrier/Usps.php as below (shown in red):

$package->addChild(‘Width’, $width);

$package->addChild(‘Length’, $length);

$package->addChild(‘Height’, $height);

$package->addChild(‘Girth’, $girth);

if($r->getDestCountryId()==’CA’){

$package->addChild(‘OriginZip’, $r->getOrigPostal());

}

It seems that USPS have since fixed this issue but we believe that a soon to come update may cause this again. So for now, everything is back as normal. If this issue appears again when USPS release their changes to their API within the next few weeks as per their recent email sent to one of our clients affected by this on May 7, 2015 at 6:28:30 AM PDT:

“May 31, 2015 USPS Web Tools will be implementing modifications and additional features to the U.S. Postal Service APIs. The following changes may especially impact shipping systems:

– Origin ZIP Code required for Priority Mail International to Canada
– Modified special services
– Modified service IDs
– Modified available mail classes for Merchandise Return Services”

Therefore this information should help people out when they encounter this error which was caused by the first bullet point change listed above.

We hope others will find this information useful.