WordPress at Your Fingertips
function is not described

WC_Order::update_status() public WC 1.0

Updates status of order immediately.

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

No Hooks.

Return

true|false.

Usage

$WC_Order = new WC_Order();
$WC_Order->update_status( $new_status, $note, $manual );
$new_status(string) (required)
Status to change the order to. No internal wc- prefix is required.
$note(string)
Optional note to add.
Default: ''
$manual(true|false)
Is this a manual order status change?.
Default: false

Code of WC_Order::update_status() WC 5.8.0

public function update_status( $new_status, $note = '', $manual = false ) {
	if ( ! $this->get_id() ) { // Order must exist.
		return false;
	}

	try {
		$this->set_status( $new_status, $note, $manual );
		$this->save();
	} catch ( Exception $e ) {
		$logger = wc_get_logger();
		$logger->error(
			sprintf(
				'Error updating status for order #%d',
				$this->get_id()
			),
			array(
				'order' => $this,
				'error' => $e,
			)
		);
		$this->add_order_note( __( 'Update status event failed.', 'woocommerce' ) . ' ' . $e->getMessage() );
		return false;
	}
	return true;
}