Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStore::migrate_post_record()
Migrate post record from a given order object.
Method of the class: OrdersTableDataStore{}
Hooks from the method
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->migrate_post_record( $order, $post_order ): void;
- $order(\WC_Abstract_Order) (required)
- Order object.
- $post_order(\WC_Abstract_Order) (required)
- Order object read from posts.
OrdersTableDataStore::migrate_post_record() OrdersTableDataStore::migrate post record code WC 9.3.3
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 ); }