Making a custom thank you page template, I want to display order number if I echo $order = new WC_Order($post_id); it returns values 0 or empty strings: but the permalink has the order id wonder what could be causing this ?
<strong><?php echo $order = new WC_Order($post_id); echo $order->get_order_number(); ?></strong>
The whole code is below:
<p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), $order ); ?></p>
<ul class="order_details">
<li class="order">
<?php _e( 'Order number:', 'woocommerce' ); ?>
<strong><?php echo $order = new WC_Order($post_id); echo $order->get_order_number(); ?></strong>
</li>
</ul>