I’m having trouble coming up with a solution for what I imagine must be a fairly common problem, and I’m interested in hearing how others have handled it. We have a WooCommerce site that we manage with Trellis. The general workflow is:
- Make content edits on staging
- Use Migrate DB Pro to push database changes from staging to production
The problem starts when we capture new e-commerce transaction data on the live site. Pushing the staging database to production overwrites this data, and I’m trying to come up with a strategy for preserving it. So far I’ve identified three options:
- Trigger an export of WooCommerce data before every sync, then re-import the data post-sync
- Use a filter with Migrate DB Pro to ignore WooCommerce fields during sync
- Use the WooCommerce api to sync transaction data back to staging in realtime
Option 1 seems cumbersome and error-prone. I’m not sure Option 2 is possible, due to the fact that WooCommerce doesn’t store order and product data in unique tables, but lumps them in as custom post types in the wp_post and wp_postmeta tables. Option 3 seems decent from a functional standpoint but it’s not trivial to set up and I haven’t found a single instance of anyone actually going this route.
I’ve found very little documentation (official or otherwise) on how to best handle this. Anyone have a solution?