Home › Forums › Order Status Rules for WooCommerce › Order status change date › Reply To: Order status change date
Hi,
Sorry for the late reply.
Order status transition history is stored in order meta with the _alg_wc_order_status_change_history
key. So it’s in the wp_postmeta
DB table. However, there is one problem – status transitions are stored in an array, i.e., it’s stored in DB as a serialized value. While it’s possible to change serialized values as well, I don’t think it’s the right way to do it. I would suggest using PHP to add a transition to the stored data.
If you add the PHP snippet below to your site, you will be able to add a transition record with such link:
https://example.com/?save_status_change&order_id=123456&from=processing&to=completed
* You need to replace 123456
, processing
and completed
with the actual “order ID”, “from” and “to” values.
Here is the snippet:
add_action( 'init', function () { if ( isset( $_GET['save_status_change'], $_GET['order_id'], $_GET['from'], $_GET['to'] ) && current_user_can( 'manage_options' ) && function_exists( 'alg_wc_order_status_rules' ) ) { $order_id = wc_clean( $_GET['order_id'] ); $from = wc_clean( $_GET['from'] ); $to = wc_clean( $_GET['to'] ); alg_wc_order_status_rules()->core->save_status_change( $order_id, $from, $to, false ); echo '<pre>' . print_r( get_post_meta( $order_id, '_alg_wc_order_status_change_history', true ), true ) . '</pre>'; die(); } } );
* You need to be logged as admin, and make sure that the “Order Status Rules for WooCommerce” plugin is enabled.
** Generally, all is done with this one line:
alg_wc_order_status_rules()->core->save_status_change( $order_id, $from, $to, false );
Please give it a try and let me know what you think.