We're trying to send programatically the shipping update with the tracking number when our third party warehouse update our system.

They're using the SOAP sales_order_shipment.create and then sales_order_shipment.addTrack.

I tried a quick fix by modifying directly the API. I added sendemail to the function addtrack so it sends emails with the tracking number when it's called. I commented the email send in the createshipment but it sends the email no matters what. So we end up sending two.

I don't know how to stop the first email from sending, we just need the one with the tracking number, and also I would love to find a way to not modify directly the API to do that.


2 Answers 2


I had exactly the same problem and it seems that there is solution without extending the API!

The shipment API has an undocumented function called sendInfo. Thanks to [cameronhimself][1] for pointing this.

public function sendInfo($shipmentIncrementId, $comment = '')

So you need something like this (for SOAP V1)

try { 
        $orderIncrementId = "Your ORDER ID";
        $itemarray = array('3' => '3', '4' => '5'); //your order items id's and qty to ship
        $comments = "some optional comments";
        $email = FALSE; //this is important! You do NOT want to sent the shipping email (email is sent with tracking number later)
        $includeComments = TRUE; //if you want to sent the comments with the email to customer

        $shipment = array($orderIncrementId, $itemarray, $comments, $email, $includeComments);

        $nship = $proxy->call($sessionId, 'sales_order_shipment.create', $shipment); //create the shippment. $nship is the new shipment id

        $proxy->call($sessionId, 'sales_order_shipment.addTrack', array('shipmentIncrementId' => $nship, 'carrier' => 'custom', 'title' => 'CARRIER TITLE', 'trackNumber' => 'YOURTARCKINGNUMBER')); //add the tracking number to shippment

        $proxy->call($sessionId, 'sales_order_shipment.sendInfo', array('shipmentIncrementId' => $nship)); //this is the fun part. Send the email of the shippment WITH the tracking number

    } catch (Exception $e) { 
        echo 'Shipment creation failed on order '. $orderIncrementId . ': ', $e->getMessage(); 
  • Hi, this worked but I'm getting blank shipment emails May 1, 2019 at 10:50

I found it! Be careful as the function create that sends the first email exists in 2 place! You have to copy the content of app/code/core/Mage/Sales/Model/Order/Shipment/Api.php and app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php to your local folder and modify both functions create by commenting the line that sends the email

// $shipment->sendEmail($email, ($includeComment ? $comment : ''));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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