15

If you select Priority Mail International and do a estimate to Canada, The handling fee comes up as a option to select for shipping.

Work around is to deselect "Priority Mail International"

3 Answers 3

13

EDIT: Keep in mind Magento resolved this issue with their SUPEE-6237 patch on Jun 18, 2015. It's probably just easier to install the patch at this point to resolve the issue.

I had a problem where the rate was showing up as $0.00 without the method name. The problem appears to coincide with the USPS rate change as of May 31st, 2015:

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

The first caused Priority mail international returns the following error:

<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>

The solution was to copy the file: app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php to app/code/local/Mage/Usa/Model/Shipping/Carrier/Usps.php

I then inserted the following code into line 394:

if($r->getDestCountryId()=='CA'){
    $package->addChild('OriginZip', $r->getOrigPostal());
}

This fixed the issue for me.

Edit: This will only work if you have your 5-digit zip code entered in the shipping origin.

4
  • I didn't realize it was a rep requirement thing, but the OP has a follow up question here that he said he couldn't put in a comment to your answer: magento.stackexchange.com/questions/69946/…
    – Mike
    Commented Jun 3, 2015 at 17:56
  • 1
    FYI, when editing the file Usps.php, I placed the code after "$package->addChild('Girth', $girth);" and before the closing curly bracket. This is in the International section of the "else". Commented Jun 3, 2015 at 18:20
  • + This resolved the issue for me Magento 1.9.1 Commented Jun 9, 2015 at 22:39
  • Can i get help about USPS Media mail -> magento.stackexchange.com/q/227667/57334
    – zus
    Commented May 28, 2018 at 5:00
2

patch SUPEE-6237 fixed issue for me. the changes in SUPEE-6237 are:

app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php
@@ -442,6 +442,17 @@ abstract class Mage_Usa_Model_Shipping_Carrier_Abstract extends Mage_Shipping_Mo
     }

     /**
+     * Check is Canada
+     *
+     * @param string $countryId
+     * @return boolean
+     */
+    protected function _isCanada($countryId)
+    {
+        return $countryId == 'CA';
+    }
+
+    /**
      * Check whether girth is allowed for the carrier
      *
      * @param null|string $countyDest

and

app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php
@@ -392,7 +392,10 @@ class Mage_Usa_Model_Shipping_Carrier_Usps
             $package->addChild('Height', $height);
             $package->addChild('Girth', $girth);

-
+            if ($this->_isCanada($r->getDestCountryId())) {
+                //only 5 chars available
+                $package->addChild('OriginZip', substr($r->getOrigPostal(), 0, 5));
+            }
             $api = 'IntlRateV2';
         }
         $request = $xml->asXML();
@@ -477,6 +480,9 @@ class Mage_Usa_Model_Shipping_Carrier_Usps
                      else {
                         if (is_object($xml->Package) && is_object($xml->Package->Service)) {
                             foreach ($xml->Package->Service as $service) {
+                                if ($service->ServiceErrors->count()) {
+                                    continue;
+                                }
                                 $serviceName = $this->_filterServiceName((string)$service->SvcDescription);
                                 $serviceCode = 'INT_' . (string)$service->attributes()->ID;
                                 $serviceCodeToActualNameMap[$serviceCode] = $serviceName;

hope this help someone.

0

Even though the original post was about Magento v1.9, I wanted to post this for others who are experiencing the same issue with Magento v2, as it still exists.

The fix requires adding the following lines right before the line $api = 'IntlRateV2'; in the file vendor/magento/module-usps/Model/Carrier.php.

$package->addChild('OriginZip', $r->getOrigPostal());
$package->addChild('AcceptanceDateTime', date('c'));
$package->addChild('DestinationPostalCode', $r->getDestPostal());

You can see the pull request about this magento2 issue here: https://github.com/magento/magento2/pull/8041

Not the answer you're looking for? Browse other questions tagged or ask your own question.