WC_Order_Data_Store_CPT::compile_orders()privateWC 1.0

Compile order response and set caches as needed for order ids.

Method of the class: WC_Order_Data_Store_CPT{}

No Hooks.

Return

Array. Orders.

Usage

// private - for code of main (parent) class only
$result = $this->compile_orders( $order_ids, $query_vars, $query );
$order_ids(array) (required)
List of order IDS to compile.
$query_vars(array) (required)
Original query arguments.
$query(WP_Query) (required)
Query object.

WC_Order_Data_Store_CPT::compile_orders() code WC 9.3.3

private function compile_orders( $order_ids, $query_vars, $query ) {
	if ( empty( $order_ids ) ) {
		return array();
	}
	$orders = array();

	$this->prime_caches_for_orders( $order_ids, $query_vars );

	foreach ( $query->posts as $post ) {
		$order = wc_get_order( $post );

		// If the order returns false, don't add it to the list.
		if ( false === $order ) {
			continue;
		}

		$orders[] = $order;
	}

	return $orders;
}