WC_API_Orders::get_orders()
Get all orders
Метод класса: WC_API_Orders{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_API_Orders = new WC_API_Orders(); $WC_API_Orders->get_orders( $fields, $filter, $status, $page );
- $fields(строка)
- -
По умолчанию: null - $filter(массив)
- -
По умолчанию: array() - $status(строка)
- -
По умолчанию: null - $page(int)
- -
По умолчанию: 1
Список изменений
С версии 2.1 | Введена. |
Код WC_API_Orders::get_orders() WC API Orders::get orders WC 8.7.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, $filter ) ); } $this->server->add_pagination_headers( $query ); return array( 'orders' => $orders ); }