Wednesday, May 18th, 2022

Update modified date in WooCommerce order

If you run a script to update order properties in WooCommerce, you may want to update the “post_modified” date along with other updates. Many third-party integrations rely on the post_modified date to sync any order changes or updates.

Here’s how you can easily update the modified date (assuming you have an Order object):

$order->set_date_modified( time() );

Here’s a complete example that receives orders, updates dates, and saves orders.

$order = wc_get_order( 123 );
$order->set_date_modified( time() );

Source link