I would like to know if there is a way that i can change status of a bunch of orders with a list of order numbers, exemple : Change status of this orders from "In progess" to "Completed"
638 637 636 635 634
Thanks
CodePudding user response:
You can loop through ids and use wp_update_post() to update stautus. Here's a list of wc order statuses.
$order_ids = [ 638, 637, 636, 635, 634 ];
foreach( $order_ids as $id ) {
wp_update_post([
'ID' => $id,
'post_status' => 'wc-completed'
]);
}