Automattic\WooCommerce\Internal\Utilities
COTMigrationUtil::init_theorder_object()
Helper function to initialize the global $theorder object, mostly used during order meta boxes rendering.
Method of the class: COTMigrationUtil{}
No Hooks.
Return
true|false|WC_Order|WC_Order_Refund
. WC_Order object.
Usage
$COTMigrationUtil = new COTMigrationUtil(); $COTMigrationUtil->init_theorder_object( $post_or_order_object );
COTMigrationUtil::init_theorder_object() COTMigrationUtil::init theorder object code WC 9.8.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; }