WordPress at Your Fingertips
function is not described

WC_Abstract_Legacy_Order::init() protected WC 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.

{} It's a method of the class: WC_Abstract_Legacy_Order{}

No Hooks.

Return

null. Nothing.

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

Code of WC_Abstract_Legacy_Order::init() WC 5.7.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 );
}