WC_Order::get_cancel_order_url()publicWC 1.0

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

Метод класса: WC_Order{}

Хуки из метода

Возвращает

Строку.

Использование

$WC_Order = new WC_Order();
$WC_Order->get_cancel_order_url( $redirect );
$redirect(строка)
Redirect URL.
По умолчанию: ''

Код WC_Order::get_cancel_order_url() WC 8.7.0

public function get_cancel_order_url( $redirect = '' ) {
	/**
	 * Filter the URL to cancel the order in the frontend.
	 *
	 * @since 2.2.0
	 *
	 * @param string $url
	 * @param WC_Order $order Order data.
	 * @param string $redirect Redirect URL.
	 */
	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'
		),
		$this,
		$redirect
	);
}