WC_Order_Factory::get_class_names_for_order_ids()
Gets the class name bunch of order instances should have based on their IDs.
Метод класса: WC_Order_Factory{}
Хуки из метода
Возвращает
Массив
. Array of order_id => class_name.
Использование
$result = WC_Order_Factory::get_class_names_for_order_ids( $order_ids );
- $order_ids(массив) (обязательный)
- Order IDs to get the class name for.
Код WC_Order_Factory::get_class_names_for_order_ids() WC Order Factory::get class names for order ids WC 9.3.3
public static function get_class_names_for_order_ids( $order_ids ) { $order_data_store = WC_Data_Store::load( 'order' ); if ( $order_data_store->has_callable( 'get_orders_type' ) ) { $order_types = $order_data_store->get_orders_type( $order_ids ); } else { $order_types = array(); foreach ( $order_ids as $order_id ) { $order_types[ $order_id ] = $order_data_store->get_order_type( $order_id ); } } $order_class_names = array(); foreach ( $order_types as $order_id => $order_type ) { $order_type_data = wc_get_order_type( $order_type ); if ( $order_type_data ) { $order_class_names[ $order_id ] = $order_type_data['class_name']; } else { $order_class_names[ $order_id ] = false; } /** * Filter classname so that the class can be overridden if extended. * * @param string $classname Order classname. * @param string $order_type Order type. * @param int $order_id Order ID. * * @since 3.0.0 */ $order_class_names[ $order_id ] = apply_filters( 'woocommerce_order_class', $order_class_names[ $order_id ], $order_type, $order_id ); if ( ! class_exists( $order_class_names[ $order_id ] ) ) { $order_class_names[ $order_id ] = false; } } return $order_class_names; }