0

We are using laravel to send our orders to and from our warehouse using the Magento API.

I am having issues sending the Order Shipment email, instead, the customers are getting the "Order Update" email that says their order is complete.

The code below add the comment into the comment history and says the customer was "Notified" but the email is not going out.

Any ideas?

try {
    $shipment = $client->call('sales_order_shipment.create', ["orderIncrementId" => $data->channel_order_code]);

    if (strlen($data->tracking) > 12) {
        $client->call('sales_order_shipment.addTrack', ['shipmentIncrementId' => $shipment, 'carrier' => "usps", 'title' => $data->channel, 'trackNumber' => $data->tracking]);
    } else {
        $client->call('sales_order_shipment.addTrack', ['shipmentIncrementId' => $shipment, 'carrier' => "fedex", 'title' => $data->channel, 'trackNumber' => $data->tracking]);
    }
    try{
        $client->call('order_shipment.addComment', ['shipmentIncrementId' => $shipment,'comment' => 'Your order has shipped with tracking number '.$data->tracking, 'email' => true]);
    }
    catch(\Exception $e)
    {
1

Please flow below steps:

Method:

sales_order_shipment.create (SOAP V1)

Allows you to create a new shipment for an order.

Aliases:

order_shipment.create

Arguments:

  1. string sessionId (Session ID)
  2. string orderIncrementId (Order increment ID)
  3. array itemsQty (Array of orderItemIdQty (optional))
  4. string comment (Shipment comment (optional))
  5. int email (Send email flag (optional))
  6. int includeComment (Include comment in email flag (optional))

API Code:

$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$orderIncrementId = '100000006';
$itemsQty = array();

$result = $proxy->call($sessionId,'order_shipment.create',array($orderIncrementId,$itemsQty,null,true,false)); //$orderIncrementId, $itemsQty = array(),$comment = null, $email = false, $includeComment = false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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