USPS fix for Magento CE 1.4.x

If you are a Magento store owner or Magento developer, you probably already noticed that USPS shipping method instantly stopped working few days ago. There was no clear announcement or whatsoever to prepare us for this outcome.


The reason for this sudden malfunction is that USPS updated (probably) their API in a manner not compatible to the previous version and all relying applications, as Magento, had to be updated also.

Magento Commerce took care of this for Magento CE 1.4.2 for which patch has been created along with instructions to guide you through the patching process.

The problem is that there is a number of stores still on Magento CE 1.4.x for which, by my recent experience, the patch doesn’t work and crashes the store.


Here’s a quick fix I made just for these situations. It could be done better, but it’l serve the purpose and allow you’re store (or your client’s) to function properly. All you have to do is unpack contents of the zip file to Magento store root folder and that’s it 🙂

Thank you.

You made it all the way down here so you must have enjoyed this post! You may also like:

Making FedEx api show shipping estimate Toni Pap
Toni Pap, | 1

Making FedEx api show shipping estimate

When can you deliver? (FedEx) Davor Simek
Davor Simek, | 6

When can you deliver? (FedEx)

Sorry, we can’t ship there Sasa Brankovic
Sasa Brankovic, | 12

Sorry, we can’t ship there


  1. Hi,
    Currently our site is on live IP ( and development mode and we want to create usps label from magento admin for particular order. But currently we are not getting any response from USPS api when we are sending request to them.

    When we will go live then shipping label will create. Can you please confirm it?

  2. Mel,

    You probably need to bite the bullet and upgrade to the latest CE version. USPS has done updates to their API in July for the new Priority mail services and etc.


  3. Interesting thing – MC – even though I changed the code accordingly in config.xml, as well as abstract.php and usps.php – I unable to see the new methods in the admin area. I have cleared cache, reindexed (several times). Still cannot see the new methods to select them. Basically #6 in the steps never changes for me.
    I should mention: Countries outside the US work but not the us.

    I am using:

    <allowed_methods>Priority Mail Express 1-Day,Priority Mail 1-Day,Priority Mail 2-Day,Priority Mail 3-Day,Bound Printed Matter,Priority Mail Express,Priority Mail Express Flat Rate Envelope,Priority Mail Express Flat Rate Envelope Hold for Pickup,Priority Mail Express Flat Rate Envelope Sunday/Holiday Guarantee,Priority Mail Express Hold for Pickup,Priority Mail Express PO to PO,Priority Mail Express Sunday/Holiday Guarantee,Priority Mail Express International,Priority Mail Express International Flat Rate Envelope,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes</allowed_methods>

    Ideas why i can’t see the new selections in the admin? And why would it not be working for the US?


  4. Thank you very much for this fix,
    I was having the same problem until i stumbled upon your site.
    I installed it on a Magento CE ver. and its working flawlessly.
    Thank you again.

  5. I am getting the following error, please help!!!!

    Call to a member function setStore() on a non-object in /XXX/XXX/…………./app/code/core/Mage/Shipping/Model/Shipping.php on line 421

  6. Worked on did have a problem at first then found that the url “” with “API” all caps works vs the “”… Thanks for saving me from a costly upgrade!

  7. Just wanted to see if you can confirm this. The patch you created (which works great) does not fix the issue on the backend when the admin user goes to create an order.

  8. I’m glad to run into this site. Thanks for the patch. I’ve been pulling my hair out.

    After placing usps_patch into the magento root, what would I then need to do to have it execute?


  9. THANK YOU – I have spent a week trying to figure this out, talking to USPS, etc…. finally a solution!!!!! You rock.

  10. After adding patch I’m getting this:
    Invalid method Mage_Usa_Model_Shipping_Carrier_Usps::_getCachedQuotes(Array
    [0] =>


  11. Thank you! Thank you! This along with adding “stg-” to the start of the shipping API URL fixed it for me using Magento 1.3.x. I was worried I would be forced to upgrade to 1.4.x which is even more of a memory hog.

  12. USPS actually sent out an email notice to everyone with an API key more than 6 months ago. I, too, didn’t notice. They are among those who feel that breaking the status quo is just fine. UPS, et al, would never make an API change that so drastically differed from the previous version.

    FWIW, I am not partial to how Magento parses the response from USPS. It’s done via a full string match. Instead, the responses should be searched for the smallest keyword that differentiates the different methods from each other.

    To break magento, usps added a trademark character to their replies. 😛

  13. Hey guys,

    I used this patch to fix my live store which was 1.3 and it worked great. I am now building a 1.5 version of the store in the background and I noticed that the USPS shipping isn’t working in Does anyone else have the same problem, (maybe a solution?) thought I would ask here as most other sites I found appear completely clueless on the subject.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.