Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::persist_updates()protectedWC 1.0

Helper method that is responsible for persisting order updates to the database.

This is expected to be reused by other order types, and should not contain any specific metadata updates or actions.

Метод класса: OrdersTableDataStore{}

No Hooks.

Return

Array. $changes Array of changes.

Usage

// protected - for code of main (parent) or child class
$result = $this->persist_updates( $order, $backfill );
$order(\WC_Order) (required) (passed by reference — &)
Order object.
$backfill **
-
Default: true

Code of OrdersTableDataStore::persist_updates() WC 7.1.0

protected function persist_updates( &$order, $backfill = true ) {
	// Fetch changes.
	$changes = $order->get_changes();

	if ( ! isset( $changes['date_modified'] ) ) {
		$order->set_date_modified( time() );
	}

	if ( $backfill ) {
		$this->maybe_backfill_post_record( $order );
	}

	$this->persist_order_to_db( $order );
	$order->save_meta_data();

	return $changes;
}