How can I get the order ID in WooCommerce?

Current method:

The current way of accomplishing this is by using this function:


That should return the order id without “#”.

Old method:

In older versions of WooCommerce, you may need to access it as a property instead:

echo $order->id;

Leave a Comment