WC_Abstract_Order::get_items()
Return an array of items/products within this order.
Метод класса: WC_Abstract_Order{}
Хуки из метода
Возвращает
WC_Order_Item[]
.
Использование
$WC_Abstract_Order = new WC_Abstract_Order(); $WC_Abstract_Order->get_items( $types );
- $types(строка|массив)
- Types of line items to get (array or string).
По умолчанию: 'line_item'
Код WC_Abstract_Order::get_items() WC Abstract Order::get items WC 9.4.2
public function get_items( $types = 'line_item' ) { $items = array(); $types = array_filter( (array) $types ); foreach ( $types as $type ) { $group = $this->type_to_group( $type ); if ( $group ) { if ( ! isset( $this->items[ $group ] ) ) { $this->items[ $group ] = array_filter( $this->data_store->read_items( $this, $type ) ); } // Don't use array_merge here because keys are numeric. $items = $items + $this->items[ $group ]; } } return apply_filters( 'woocommerce_order_get_items', $items, $this, $types ); }