I am using this simple code:
$order = commerce_order_load($order_id);
$order->status='completed';
field_attach_update('commerce_order', $order);
To update the status of order to completed
.
This code use to work but does not work anymore (the order status is not updated).
How to debug this ?
UPDATE:
Using :
entity_get_controller('commerce_order')->resetCache(array($order->order_id));
Does not work neither.