Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection
HandlerRegistry::get_product_ids_from_order
Get product IDs from an order.
Метод класса: HandlerRegistry{}
Хуков нет.
Возвращает
Массив
. The product IDs.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_product_ids_from_order( $order_id );
- $order_id(int) (обязательный)
- The order ID.
Код HandlerRegistry::get_product_ids_from_order() HandlerRegistry::get product ids from order WC 9.9.4
private function get_product_ids_from_order( $order_id ) { $product_references = array(); if ( empty( $order_id ) ) { return $product_references; } $order = wc_get_order( $order_id ); if ( $order ) { $product_references = array_filter( array_map( function ( $item ) { return $item->get_product_id(); }, $order->get_items( 'line_item' ) ) ); } return $product_references; }