Change order increment_id of existing orders
-
12-12-2019 - |
Question
In a test system I would like to change increment_id for all orders. Otherwise I would get conflics with another module.
Can I simple change increment_id in sales_flat_order or will this messup Magento?
Solution
According to this it should be fine to change sales_flat_order
.
I run two querys to change order id:
UPDATE sales_flat_order SET increment_id = CONCAT('10-', increment_id);
UPDATE sales_flat_order_grid SET increment_id = CONCAT('10-', increment_id);
And no problems so far.
Update
As mentioned by R.S. you may also like to change the next order id prefix.
Here is some untested code for this:
UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='10-'
WHERE eav_entity_type.entity_type_code='order';
Also you might need to change increment_last_id
in eav_entity_store
but I am not sure. I did not need this.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange