WC_API_Orders::get_orders( string $fields = null, array $filter = array(), string $status = null, int $page = 1 )

Get all orders


Description Description


Parameters Parameters

$fields

(Optional)

Default value: null

$filter

(Optional)

Default value: array()

$status

(Optional)

Default value: null

$page

(Optional)

Default value: 1


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-orders.php

	public function get_orders( $fields = null, $filter = array(), $status = null, $page = 1 ) {

		if ( ! empty( $status ) ) {
			$filter['status'] = $status;
		}

		$filter['page'] = $page;

		$query = $this->query_orders( $filter );

		$orders = array();

		foreach ( $query->posts as $order_id ) {

			if ( ! $this->is_readable( $order_id ) ) {
				continue;
			}

			$orders[] = current( $this->get_order( $order_id, $fields, $filter ) );
		}

		$this->server->add_pagination_headers( $query );

		return array( 'orders' => $orders );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.