Merging updated dev site with live site while keeping orders correct

With the current state of the development database you’re going to have to manually re-apply your changes to either live, or preferably a staging environment that has been set up to use something like Mergebot, I can’t see any clean way of automating your deployment otherwise.

Why Mergebot can’t help given the current state of the database:

Mergebot is a great solution for the problem of working with a dev site that is a copy of a live site with transaction data such as WooCommerce orders being created while working on dev. It’s one of the prime reasons it was created.

However, Mergebot works by recording changes to the dev site and needs the dev site to have been a clean copy of the live site when recording started. Usually you create a copy of the live site with something like WP Migrate DB Pro (bundled with Mergebot subscription) and then start recording, when finished you deploy to live via Mergebot which takes care of merging and walks you through conflict resolution where needed.

In the above scenario the dev database has already diverged significantly from live before recording is to start, so I don’t think Mergebot is a solution unless the dev work can be re-applied to a fresh copy of live. Removing products is also a serious problem, they should be removed from sale but left intact if already purchased by customers.

There’s a better description of Mergebot here:- https://deliciousbrains.com/database-merging-made-easy/

And if you prefer screencasts, check out this post:- https://deliciousbrains.com/mergebot-in-beta/

Full disclosure: while I don’t directly work on Mergebot, I do work for Delicious Brains, the developers of Mergebot.