Created
October 29, 2019 13:59
-
-
Save felipe-pita/d7eeb46a1563fca390c1ab0c6af0da81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Altera o status do de cuncluido para enviado | |
*/ | |
add_action('admin_post_update_processing_orders', 'nerdstore_update_processing_orders'); | |
function nerdstore_update_processing_orders() { | |
echo '<pre>'; | |
global $wpdb; | |
$processing_orders = $wpdb->get_col(" | |
SELECT posts.ID | |
FROM {$wpdb->posts} AS posts | |
WHERE posts.post_status = 'wc-processing'" | |
); | |
print_r(count($processing_orders) . ' pedidos.'); | |
echo "\n"; | |
if ($processing_orders) { | |
foreach ($processing_orders as $order) { | |
$order = wc_get_order($order); | |
$order_date_modified = $order->get_date_created(); | |
$date = new DateTime($order_date_modified); | |
$date->add(DateInterval::createFromDateString('1 minute')); | |
$order->set_date_created($date->getTimestamp()); | |
$order->save(); | |
die('pedido: ' . $order->get_id() . ' atualizado.'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment