/**
* Get the raw (unescaped) cancel-order URL
*
* Backports WC_Order::get_cancel_order_url_raw() to WC 2.3.5 and lower
*
* @since 3.1.1
* @param \WC_Order $order
* @return string The unescaped cancel-order URL
*/
public static function get_cancel_order_url_raw(WC_Order $order, $redirect = '')
{
if (self::is_wc_version_gt('2.3.5')) {
return $order->get_cancel_order_url_raw($redirect);
} else {
// Get cancel endpoint
$cancel_endpoint = self::wc_get_page_permalink('cart');
if (!$cancel_endpoint) {
$cancel_endpoint = home_url();
}
if (false === strpos($cancel_endpoint, '?')) {
$cancel_endpoint = trailingslashit($cancel_endpoint);
}
return apply_filters('woocommerce_get_cancel_order_url_raw', add_query_arg(array('cancel_order' => 'true', 'order' => $order->order_key, 'order_id' => $order->id, 'redirect' => $redirect, '_wpnonce' => wp_create_nonce('woocommerce-cancel_order')), $cancel_endpoint));
}
}