Where is the default commerce order_id set and how can i change it to my custom order number?

I am using the Commerce Order Counter module to set a custom order number. drupal.org/project/commerce_order_counter

The problem i have is the order_id that is passed to paypal is the default commerce order_id and not my custom order number.


You cannot change order id as other functionalities are dependent on it.But you can change order number before saving order to shopping cart status by using hook_commerce_order_presave($order).

function example_commerce_order_presave($order) {
   if ($order->status == 'cart') {
   $order->order_number = 'new order number;
| improve this answer | |

Try the hook_commerce_order_presave($order)

which has options to alter the order object before saving. Maybe you can add your custom code inside this function an alter the order id.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.