WC_Order::get_cancel_order_url( string $redirect = '' )

Generates a URL so that a customer can cancel their (unpaid – pending) order.


Description Description


Parameters Parameters

$redirect

(Optional) Redirect URL.

Default value: ''


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-order.php

	public function get_cancel_order_url( $redirect = '' ) {
		return apply_filters(
			'woocommerce_get_cancel_order_url',
			wp_nonce_url(
				add_query_arg(
					array(
						'cancel_order' => 'true',
						'order'        => $this->get_order_key(),
						'order_id'     => $this->get_id(),
						'redirect'     => $redirect,
					),
					$this->get_cancel_endpoint()
				),
				'woocommerce-cancel_order'
			)
		);
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.