Automattic\WooCommerce\Internal\Utilities
COTMigrationUtil::init_theorder_object
Helper function to initialize the global $theorder object, mostly used during order meta boxes rendering.
Метод класса: COTMigrationUtil{}
Хуков нет.
Возвращает
true|false|WC_Order|WC_Order_Refund. WC_Order object.
Использование
$COTMigrationUtil = new COTMigrationUtil(); $COTMigrationUtil->init_theorder_object( $post_or_order_object );
Код COTMigrationUtil::init_theorder_object() COTMigrationUtil::init theorder object WC 10.5.2
public function init_theorder_object( $post_or_order_object ) {
global $theorder;
if ( $theorder instanceof WC_Order ) {
return $theorder;
}
if ( $post_or_order_object instanceof WC_Order ) {
$theorder = $post_or_order_object;
} else {
$theorder = wc_get_order( $post_or_order_object->ID );
}
return $theorder;
}