Create a shipment

Tweet, share & co

tweet fb share g+ share

Tags


Description

code to create a shipment for an order

Code

$order = Mage::getModel('sales/order')->loadByIncrementId('100000001');
try {
    if($order->canShip()) {
        //Create shipment
        $shipmentid = Mage::getModel('sales/order_shipment_api')
                        ->create($order->getIncrementId(), array());
        //Add tracking information
        $ship = Mage::getModel('sales/order_shipment_api')
                        ->addTrack($order->getIncrementId(), array());       
    }
}catch (Mage_Core_Exception $e) {
 print_r($e);
}