I'm trying to use a wordpress cron to update the Woocommerce order status. I've tried to have a go with the below code in my functions.php in the child theme but it does not seem to affect the order status.
I've tried adding an action to use for WP Crontrol to run the function at specific times. If anyone could let me know where I am going wrong??
function WPCrontrol_cron_update_order_statuses($order_id) {
$order = wc_get_order( $order_id );
$order_status = $order->get_status();
if ($order_status == 'wc-processedorder'){
$order->update_status('wc-orderreadyprint');
}
}
add_action('cron_update_order_statuses','WPCrontrol_cron_update_order_statuses');