Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::migrate_post_record()privateWC 1.0

Migrate post record from a given order object.

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

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->migrate_post_record( $order, $post_order ): void;
$order(\WC_Abstract_Order) (обязательный)
Order object.
$post_order(\WC_Abstract_Order) (обязательный)
Order object read from posts.

Код OrdersTableDataStore::migrate_post_record() WC 9.4.2

private function migrate_post_record( \WC_Abstract_Order &$order, \WC_Abstract_Order $post_order ): void {
	$diff                 = $this->migrate_meta_data_from_post_order( $order, $post_order );
	$post_order_base_data = $post_order->get_base_data();
	foreach ( $post_order_base_data as $key => $value ) {
		$this->set_order_prop( $order, $key, $value );
	}
	$this->persist_updates( $order, false );

	/**
	 * Fired when an HPOS order is updated from its corresponding post record on read due to a difference in the data.
	 *
	 * @since 8.5.0
	 *
	 * @param \WC_Order $order The order object.
	 * @param array     $diff  Difference between HPOS data and post data.
	 */
	do_action( 'woocommerce_hpos_post_record_migrated_on_read', $order, $diff );
}