Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::backfill_post_record()publicWC 1.0

Backfills order details in to WP_Post DB. Uses WC_Order_Data_store_CPT.

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

No Hooks.

Return

null. Nothing.

Usage

$OrdersTableDataStore = new OrdersTableDataStore();
$OrdersTableDataStore->backfill_post_record( $order );
$order(\WC_Abstract_Order) (required)
Order object to backfill.

Code of OrdersTableDataStore::backfill_post_record() WC 7.1.0

public function backfill_post_record( $order ) {
	$cpt_data_store = $this->get_post_data_store_for_backfill();
	if ( is_null( $cpt_data_store ) || ! method_exists( $cpt_data_store, 'update_order_from_object' ) ) {
		return;
	}

	$cpt_data_store->update_order_from_object( $order );
	foreach ( $cpt_data_store->get_internal_data_store_key_getters() as $key => $getter_name ) {
		if (
			is_callable( array( $cpt_data_store, "set_$getter_name" ) ) &&
			is_callable( array( $this, "get_$getter_name" ) )
		) {
			call_user_func_array(
				array(
					$cpt_data_store,
					"set_$getter_name",
				),
				array(
					$order,
					$this->{"get_$getter_name"}( $order ),
				)
			);
		}
	}
}