If you run a script to update order properties in WooCommerce, you may want to update the “post_modified” date along with the 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 the order object):
$order->set_date_modified( time() );
Here’s a full example which fetches the order, updates the date, and saves the order.
$order = wc_get_order( 123 );
$order->set_date_modified( time() );
$order->save();