Hi,
I tested it again, and it took the ID. For now, I found a solution using a function..
// Хелпер функция – взема поръчка от URL (?key=wc_order_...)
function get_order_from_thank_you_page() {
if ( ! isset($_GET['key']) ) return false;
$order_key = sanitize_text_field( $_GET['key'] );
$order_id = wc_get_order_id_by_order_key( $order_key );
if ( ! $order_id ) return false;
return wc_get_order( $order_id );
}
add_shortcode( 'customer_order_number', function() {
$order = get_order_from_thank_you_page();
if ( ! $order ) return '';
return esc_html( $order->get_order_number() );
});
Are you planning to develop this page? Many options are missing now.
To make it more customizable and meaningful, it would be nice to be able to display all the fields separately – price, customer name, phone, email…. etc. Otherwise, it becomes a bit meaningless and I have to insert my own code to make it look different from the classic one.