I need to run
commerce_order_save() on several Orders in loop but without triggering any Rules.
Is that possible ?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
It's possible, but the change would need to be sitewide (not just in the context of rules). You'd need to override the entity controller class used for commerce_product (which you could do with
hook_entity_info_alter()), and re-implement its
save() method so it doesn't invoke the entity hooks.
If that is undesirable (probably is), and you just need to update field values, you can use
field_attach_update() instead, which will bypass the entity save process altogether:
$order->some_field[LANGUAGE_NONE]['value'] = 'foo'; field_attach_update('commerce_order', $order);
Other than those I don't think there's any way to accomplish it using the API.