Automatic exports with the Customer/Order CSV Export will not export orders that have previously been marked as exported. This is intentional to prevent duplication of exported orders. However, consider this case:
- An export was done which includes orders in a failed status.
- The automatic export configuration is changed to only include orders in a processing status
- The order that had failed is paid for and so the status is updated to processing
That particular order would not be included in the next automatic update because it has already been exported. Shop managers need to be aware of this behaviour in case they are using the automatic export for fulfilment (a common use-case). Generally speaking, the expectation is that the Shop manager would be aware of this changed order status and use the bulk actions in order to mark the order as not exported so that it does get exported. That’s a lot of overhead, unfortunately. In this type of case, one may wish to consider automating the marking of orders as not exported. The following code snippet will do just that by leveraging the WooCommerce provided order status update hooks. Here’s an example of how you might achieve that:
Not sure what to do with code snippets? See What Do I Do With These Code Snippets?