Just like cancel order, I have created a new status card_decline
I have set canceled
state to this new status.
Now when I am updating any order to card_decline
status programmatically then it is not reverting product quantity from order just like we get quantity reverted to products when we cancel any order.
For cancel order we just use cancel code like this: https://magento.stackexchange.com/a/115279/49772
I am updating status like this:
$orderState = Order::STATE_CANCELED;
$order->setState($orderState)->setStatus("card_declined");
$order->addStatusToHistory($order->getStatus(), '');
$order->save();
I know just changing status wont revert back quantity, please help me find approach to revert quantity along with status update.