I too had this issue. After enabling the plugin, already existing orders started to get new order numbers.
It seems your plugin adds the new order number whenever the action wp_insert_post
runs. This actions runs every time a post is created, but also when it is updated.
Your function add_new_order_number
should check the third argument that is passed along this action, $update. If this is true, the function should not run add_order_number_meta
.