You simply missed the WooCommerce plugin file includes/wc-template-hooks.php where the action hook woocommerce_thankyou is called on line 260 triggering woocommerce_order_details_table() function, which is located on includes/wc-template-functions.php from line 2641 to 2560:
if ( ! function_exists( 'woocommerce_order_details_table' ) ) {
/**
* Displays order details in a table.
*
* @param mixed $order_id Order ID.
*/
function woocommerce_order_details_table( $order_id ) {
if ( ! $order_id ) {
return;
}
wc_get_template(
'order/order-details.php',
array(
'order_id' => $order_id,
)
);
}
}
As you can see this function calls the WooCommerce template order/order-details.php, that outputs the related order details.
So you will have to edit the WooCommerce template order/order-details.php to make changes. But this template is used many times on other pages.
So you can target the WooCommerce thankyou page using is_wc_endpoint_url('order-received') conditional tag and you will be able to override this template using it like:
if ( is_wc_endpoint_url('order-received') ) {
// The altered code for the thankyou page
} else {
// The normal code for all other pages
}
Related: WooCommerce action hooks and overriding templates