Automattic\WooCommerce\Internal\Utilities
COTMigrationUtil::is_order()
Checks if passed id, post or order object is a WC_Order object.
Method of the class: COTMigrationUtil{}
No Hooks.
Return
true|false
. Whether the passed param is an order.
Usage
$COTMigrationUtil = new COTMigrationUtil(); $COTMigrationUtil->is_order( $order_id, $types ) : bool;
- $order_id(int|WP_Post|WC_Order) (required)
- Order ID, post object or order object.
- $types(string[])
- Types to match against.
Default: array( foo )
COTMigrationUtil::is_order() COTMigrationUtil::is order code WC 9.8.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 ); }