Are you sure the orders are completed? What about editing the order, and setting the status to completed again, manually?
I believe there are two metas for backwards compatibility reasons. WC 3.0 (was originally tagged at 2.7) made changes to how dates were stored, some history here: https://github.com/woocommerce/woocommerce/issues/13498
The safest way, moving forward, would be to use the methods on the order object to update these values. So $order_object->set_date_completed( '2018-08-25' ) for example.
So could get a list of order IDs with no completed date, then loop through them all and set a date (hopefully based on another date that was stored already).
Thread Starter
mic6
(@mic6)
Thanks Caleb, very good suggestion
Thread Starter
mic6
(@mic6)
For some reason it’s not quite working.
I tried with set_date_completed( ‘2018-08-25’ ) and the one below, no difference, no errors, but no changes to order date. If i print out the order details, I can see it’s the right order it’s trying to change.
function change_order_details() {
$order_id=115;
$order = wc_get_order( $order_id );
$order->set_date_completed( ‘2017-10-16 13:48:10’ );
}
add_action( ‘wp_head’, ‘change_order_details’ );
Am i missing something?
Thread Starter
mic6
(@mic6)
@icaleb any idea what could be wrong?
Need to save after.
$order->save();
Thread Starter
mic6
(@mic6)
Ah of course.. Thanks working perfectly now.