WC_API_Orders::get_orders() public WC 2.1
Get all orders
{} It's a method of the class: WC_API_Orders{}
No Hooks.
Return
Array.
Usage
$WC_API_Orders = new WC_API_Orders(); $WC_API_Orders->get_orders( $fields, $filter, $status, $page );
- $fields(string)
- -
- $filter(array)
- -
- $status(string)
- -
- $page(int)
- -
Changelog
Since 2.1 | Introduced. |
Code of WC_API_Orders::get_orders() WC API Orders::get orders WC 5.0.0
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 ) );
}
$this->server->add_pagination_headers( $query );
return array( 'orders' => $orders );
}