I am using this simple code:

$order = commerce_order_load($order_id);
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 ?


Using :


Does not work neither.

1 Answer 1


You can't debug what ain't a bug :)

status is a property, not a field, of the commerce_order entity type - so it isn't affected by running field_attach_update(), which just saves field data, and avoids saving the entity itself.

You'll need to use commerce_order_save(), entity_save(), or manipulate the commerce_order table directly, and then clear the cache using the entity controller.

  • 1
    You beat me to it ;) May 18, 2016 at 14:52
  • @Clive how is that this worked previously ? May 18, 2016 at 15:00
  • I'm not really sure how to answer that - according to the code, it didn't.
    – Clive
    May 18, 2016 at 15:03

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.