WC_Abstract_Legacy_Order::init()protectedWC 1.0

Deprecated from version 3.0.0 Logic moved to constructor. It is no longer supported and can 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.

Return

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 8.7.0

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 );
}