Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Modifying Order Number is breaking revisions

I have created an API using Drupal Services to allow an external system to create Drupal Commerce orders.

The orders received via the external system need the order_number prefixed. E.g.

EXT100424

I can easily add the prefix like this

$order_wrapper->order_number->set('EXT' . $order_wrapper->order_number->value());

The order saves OK but when you view the order in the CMS there is no payment and revision data. So the reference to revisions and payment data is broken by modifying the order_number.

I have tried modifying the order_number in hook_commerce_order_presave() but with the same result.

I would have expected order_id to be used to reference the order so that order_number could be modified like this.

scott anderson
Asked by: scott anderson
on June 23, 2015

1 Answer

Vote up!
0
Vote down!

Might it be cleaner to add a field to store the external order number in, and then concatenate them as needed for the external system?

Andy @ BlueFusion
Posted: Jun 24, 2015