0

enter image description here how to update order Items qty in admin panel? (magento 1.9)

1 Answer 1

1

update order Items qty programmatically.

please create order.php in magento root file and its run www.domain.com/order.php

<?php
    require_once('../app/Mage.php');
    umask(0);
    Mage::app();

    $order_id = 1234; //use your own order id 
    $order = Mage::getModel("sales/order")->load($order_id); //load order by order id 
    $ordered_items = $order->getAllItems();
       foreach($ordered_items as $item){     //item detail 
          $item->setQtyOrdered($item->getQtyOrdered() - 1)->save();
       } 
    $order->setStatus("complete");       
    $change = $order->addStatusHistoryComment('Order was set to Complete by our automation tool.', false);
    $change->setIsCustomerNotified(false);
    $order->save();
 ?>

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.