woocommerce_get_cancel_order_url filter-hookWC 2.2.0

Filter the URL to cancel the order in the frontend.

Usage

add_filter( 'woocommerce_get_cancel_order_url', 'wp_kama_woocommerce_get_cancel_order_url_filter', 10, 3 );

/**
 * Function for `woocommerce_get_cancel_order_url` filter-hook.
 * 
 * @param string   $url      
 * @param WC_Order $order    Order data.
 * @param string   $redirect Redirect URL.
 *
 * @return string
 */
function wp_kama_woocommerce_get_cancel_order_url_filter( $url, $order, $redirect ){

	// filter...
	return $url;
}
$url(string)
-
$order(WC_Order)
Order data.
$redirect(string)
Redirect URL.

Changelog

Since 2.2.0 Introduced.

Where the hook is called

WC_Order::get_cancel_order_url()
woocommerce_get_cancel_order_url
woocommerce/includes/class-wc-order.php 1830-1846
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
);

Where the hook is used in WooCommerce

Usage not found.