WordPress at Your Fingertips
function is not described

WC_Order_Data_Store_CPT::compile_orders() private WC 1.0

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

{} It's a method of the class: WC_Order_Data_Store_CPT{}

No Hooks.


Array. Orders.


// 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.

Code of WC_Order_Data_Store_CPT::compile_orders() WC 5.8.0

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

	// Lets do some cache hydrations so that we don't have to fetch data from DB for every order.
	$this->prime_raw_meta_cache_for_orders( $order_ids, $query_vars );
	$this->prime_refund_caches_for_order( $order_ids, $query_vars );
	$this->prime_order_item_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 ) {

		$orders[] = $order;

	return $orders;