Magento1.9 – Generate UPS Shipping Label

shippingups

I came through a problem with shipping labels on Magento 1.9.

When I try to create a label for UPS (using button "ship" and checking "create shipping label") a popup appears (so far so good) BUT after I create my package and clicking "ok" I got an

"Missing or invalid ship from address line 1".

As far as I know this is coming from UPS API.

My addresses are OK, I tried with several ones, but still got this error message.

Does someone have an idea about what is going on?

Best Answer

I have found how to fix this!

This was due to a too long shipper address (more than the 35 max characters allowed by UPS) and a little bug in Magento.

In Mage_Usa_Model_Shipping_Carrier_Ups::_formShipmentRequest method the address line 1 for shipper is set like this:

$addressPart->addChild('AddressLine1', $request->getShipperAddressStreet());
$addressPart->addChild('AddressLine2', $request->getShipperAddressStreet2());

As you could see the address line 1 is set with getRecipientAddressStreet() and NOT getRecipientAddressStreet1() which leads to insert address line 1 AND 2 in address line 1 shipper address in UPS request.

Could simple be fixed by replacing getRecipientAddressStreet by getRecipientAddressStreet1. I would recommend to extends class in a module.

Related Topic