WordPress at Your Fingertips
function is not described

Abstract_WC_Order_Data_Store_CPT::delete() public WC 1.0

Method to delete an order from the database.

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

Return

null. Nothing.

Usage

$Abstract_WC_Order_Data_Store_CPT = new Abstract_WC_Order_Data_Store_CPT();
$Abstract_WC_Order_Data_Store_CPT->delete( $order, $args );
$order(WC_Order) (required) (passed by reference — &)
Order object.
$args(array)
Array of args to pass to the delete method.
Default: array()

Code of Abstract_WC_Order_Data_Store_CPT::delete() WC 5.8.0

public function delete( &$order, $args = array() ) {
	$id   = $order->get_id();
	$args = wp_parse_args(
		$args,
		array(
			'force_delete' => false,
		)
	);

	if ( ! $id ) {
		return;
	}

	if ( $args['force_delete'] ) {
		wp_delete_post( $id );
		$order->set_id( 0 );
		do_action( 'woocommerce_delete_order', $id );
	} else {
		wp_trash_post( $id );
		$order->set_status( 'trash' );
		do_action( 'woocommerce_trash_order', $id );
	}
}