WC_Abstract_Legacy_Order::cancel_order()publicWC 1.0

Deprecated from version 3.0.0 Moved to event handler.. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Cancel the order and restore the cart (before payment).

Method of the class: WC_Abstract_Legacy_Order{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Abstract_Legacy_Order = new WC_Abstract_Legacy_Order();
$WC_Abstract_Legacy_Order->cancel_order( $note );
$note(string)
Optional note to add.
Default: ''

Changelog

Deprecated since 3.0.0 Moved to event handler.

WC_Abstract_Legacy_Order::cancel_order() code WC 8.9.0

public function cancel_order( $note = '' ) {
	wc_deprecated_function( 'WC_Order::cancel_order', '3.0', 'WC_Order::update_status' );
	WC()->session->set( 'order_awaiting_payment', false );
	$this->update_status( 'cancelled', $note );
}