Automattic\WooCommerce\Internal\Utilities

COTMigrationUtil::is_order()publicWC 1.0

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

{} Это метод класса: COTMigrationUtil{}

Хуков нет.

Возвращает

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

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

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

Код COTMigrationUtil::is_order() WC 6.9.1

public function is_order( $order_id, array $types = array( 'shop_order' ) ) : bool {
	$order_id         = $this->get_post_or_order_id( $order_id );
	$order_data_store = \WC_Data_Store::load( 'order' );
	return in_array( $order_data_store->get_order_type( $order_id ), $types, true );
}