WC_Abstract_Legacy_Order::initprotectedWC 1.0

Deprecated since 3.0.0 Logic moved to constructor. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.

Load the order object. Called from the constructor.

Method of the class: WC_Abstract_Legacy_Order{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->init( $order );
$order(int|object|WC_Order) (required)
Order to init.

Changelog

Deprecated since 3.0.0 Logic moved to constructor

WC_Abstract_Legacy_Order::init() code WC 10.8.1

protected function init( $order ) {
	wc_deprecated_function( 'WC_Order::init', '3.0', 'Logic moved to constructor' );
	if ( is_numeric( $order ) ) {
		$this->set_id( $order );
	} elseif ( $order instanceof WC_Order ) {
		$this->set_id( absint( $order->get_id() ) );
	} elseif ( isset( $order->ID ) ) {
		$this->set_id( absint( $order->ID ) );
	}
	$this->set_object_read( false );
	$this->data_store->read( $this );
}