Create a regular post for every WooCommerce order

in comments I propose to make the order as public but I found a easier way to display a order : with a shortcode

i try this in a plugin :

add_shortcode("view_order", function ($atts, $content = "", $tag) {

    if (!isset($_GET["order_id"])) {
        return "no id";

    $order = get_post($_GET["order_id"]);

    if (    !isset($order)
        ||  ("shop_order" !== $order->post_type)
    ) {
        return "no shop_order";

    // result of the shortcode


    echo "<pre>";
    echo "</pre>";

    return ob_get_clean();

then in a page (“preview order” in my exemple) put the shortcode [view_order] and you can see the details of the order on the URL :