Magento USPS Rate Calculator Break

On December 17, 2010 the US Postal Service let customers know that a change was coming to the domestic shipping services.  These changes went into effect and caused the USPS shipping calculator in Magento to stop working.

The root cause is that the shipping method name now has a “®” symbol at the end of it.

Following is a fix for the issue that involves a change to core code to get you back up and running. The fix removes the ® symbol in the method name.

This fix was first reported in the Magento Forum here, but I’ve reduced it down to two steps for those that don’t want to read through six pages of forum posts.

In file:  /app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php

Step 1: Find the following line of code:

1
foreach ($xml->Package->Postage as $postage) {

And add the following line immediately after it.

1
$postage->MailService = str_replace("<sup>®</sup>","",(string)$postage->MailService);

Step 2: In the same file, find the following line of code:

1
foreach ($xml->Package->Service as $service) {

And add the following line immediately after it.

1
$service->SvcDescription = str_replace("<sup>®</sup>","",(string)$service->SvcDescription);

Be sure to clear cache and re-compile if necessary.

Update – First Class Mail

In addition to the changes above, the First Class mail method names need to be updated so they will work.

In  file: /app/code/core/Mage/Usa/etc/config.xml

Find the <usps> area and change the following tags for <allowed_methods> and <methods>.

From:

  • First-Class Mail International Large Envelope
  • First-Class Mail International Letters
  • First-Class Mail International Package
  • First-ClassFirst-Class Mail
  • First-Class Mail Flat
  • First-Class Mail International
  • First-Class Mail Letter
  • First-Class Mail Parcel

To:

  • First-Class Mail International Large Envelope**
  • First-Class Mail International Letters**
  • First-Class Mail International Package**
  • First-Class Mail Package
  • First-Class Mail Large Envelope

Some of the old methods don’t seem to be available anymore.   The new names will now display in the admin area control panel  (System > Configuration > Sales > Shipping Methods > USPS )  so your store administrator can activate them.  Unfortunately the asterisks are currently required on the International option.

LiveZilla Live Help