Automattic\WooCommerce\Internal\Utilities
COTMigrationUtil::is_order()
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() COTMigrationUtil::is order WC 9.4.2
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 ); }