Is it possible to update order item price and order total after order is place
-
12-12-2019 - |
Question
Hi want to update order item price and grand total and order details after order is placed.
suppose,I have place an order with item
Item A
- order item price $10
Item b
- order item price $20
Discount is $5
Grandtotal - $25
Now my order status is pending
and want update order item price and other price
just like it
Item A
- order item price $40
Item b
- order item price $30
Discount is $7
Grandtotal - $63
Is it possible?
Solution
I think you can do this just like you would modify any other model instance
$item = Mage::getModel('sales/order_item')->load(id here)l
$item->setPrice(40)->setBasePrice(40)->save();
then
$order = Mage::getModel('sales/order')->load(order id here);
$order->setSubtotal(70)->setBaseSubtotal(70);
$order->setDiscountAmount(7)->setBaseDiscountAmout(7);
$order->setGrandTotal(63)->setBaseGrandTotal(63);
$order->save();
You might also need to change other values like tax, subtotal_incl_tax and others.
But this is a bad practice and you should not do it. It is better just to cancel the order and create a new one.
OTHER TIPS
I have created the solution to update particular item price and recalculate order amount, please refer my answer @ Update order total after order place