I tried to use hook_entity_update() to make some changes to an order after the checkout process is completed and the order status is changed to pending.

Because of the order status being changed via Rules, the hook_entity_update() is not triggered and cannot make other changes I need.

Comments

rszrama’s picture

Category: bug » support
Status: Active » Closed (works as designed)

Any order status update triggers an order save, which ultimately calls our entity controller's invoke method where the entity_* hooks are invoked. If you didn't clear the cache before testing your code, the hook wouldn't have been registered. However, you should probably be using hook_commerce_checkout_complete() instead, instead of being dependent on order updates. You never know when an order update may cause an order to pass through the pending status, but the checkout completion hook should only be called once for any given order.