WordPress at Your Fingertips
function is not described

WC_Abstract_Legacy_Order::cancel_order() public WC 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).

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

No Hooks.


null. Nothing.


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


Deprecated Since 3.0.0 Moved to event handler.

Code of WC_Abstract_Legacy_Order::cancel_order() WC 5.5.2

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