on live site , i used this redirection for time being , i have remove this code from staging.
add_action(‘template_redirect’, ‘redirect_old_thankyou_to_checkout’);
function redirect_old_thankyou_to_checkout() {
// Check if we’re on the old thank you URL pattern
if (preg_match(‘/thankyou\/order-received\/(\d+)/’, $_SERVER[‘REQUEST_URI’], $matches)) {
$order_id = $matches[1];
$order_key = isset($_GET[‘key’]) ? $_GET[‘key’] : ”;
if ($order_id && $order_key) {
// Build the correct WooCommerce thank you URL
$new_url = wc_get_checkout_url() . ‘order-received/’ . $order_id . ‘/?key=’ . $order_key;
wp_redirect($new_url, 301);
exit;
}
}
}