Automattic\WooCommerce\Utilities

OrderUtil::is_order()public staticWC 1.0

Checks if passed id, post or order object is a WC_Order object.

Метод класса: OrderUtil{}

Хуков нет.

Возвращает

true|false. Whether the passed param is an order.

Использование

$result = OrderUtil::is_order( $order_id, $types );
$order_id(int|WP_Post|WC_Order) (обязательный)
Order ID, post object or order object.
$types(string[])
Types to match against.
По умолчанию: array( foo )

Код OrderUtil::is_order() WC 8.7.0

public static function is_order( $order_id, $types = array( 'shop_order' ) ) {
	return wc_get_container()->get( COTMigrationUtil::class )->is_order( $order_id, $types );
}