Automattic\WooCommerce\Utilities

OrderUtil::is_order()public staticWC 1.0

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

Method of the class: OrderUtil{}

No Hooks.

Return

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

Usage

$result = OrderUtil::is_order( $order_id, $types );
$order_id(int|WP_Post|WC_Order) (required)
Order ID, post object or order object.
$types(string[])
Types to match against.
Default: array( foo )

OrderUtil::is_order() code WC 8.6.1

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