i use WooCommerce Order DeliveryIt depends in which database table this Delivery Date is inserted, but once you know that it's not so difficult to check those dates and if the current date is +1 change the status.
Is this Delivery Date added by a WooCommerce extension or by a third-party plug-in?
function auto_change_order_status() {
global $wpdb;
$results = $wpdb->get_results("
SELECT *
FROM $wpdb->posts
WHERE post_type = 'shop_order'
AND post_status = 'wc-processing'
");
if (!$results) return;
else {
foreach ($results as $result) {
$delivery_date = get_post_meta( $result->ID, '_delivery_date', true );
$currentdate = date ('Y-m-d');
if ($currentdate >= $delivery_date) {
$ord = new WC_Order($result->ID);
$ord->update_status('wc-completed');
}
}
}
}
add_action('init', 'auto_change_order_status');
thank you so much, workedSomething like this in functions.php or a custom code snippets plug-in:
PHP:function auto_change_order_status() { global $wpdb; $results = $wpdb->get_results(" SELECT * FROM $wpdb->posts WHERE post_type = 'shop_order' AND post_status = 'wc-processing' "); if (!$results) return; else { foreach ($results as $result) { $delivery_date = get_post_meta( $result->ID, '_delivery_date', true ); $currentdate = date ('Y-m-d'); if ($currentdate >= $delivery_date) { $ord = new WC_Order($result->ID); $ord->update_status('wc-completed'); } } } } add_action('init', 'auto_change_order_status');