How can I get the order date in WooCommerce?

I see inside class-wc-admin-cpt-shop_order.php there are some functions that collect order information for display in WooCommerce. However, I do not see anywhere where you can use the date ...

Since WooCommerce uses wp_posts to store data, can I assume that the post_date field is the right one to use?

Also, does anyone know if there is a function in WooCommerce to get this, or is there a way to get the date in class-wc-admin-cpt-shop_order.php .

+4
source share
2 answers

You can use the WC_Order object if you have an order identifier:

 $order = new WC_Order($order_id); $order_date = $order->order_date; 
+9
source

You cannot directly access the properties of an order. The best way is $order->get_date_completed()

0
source

All Articles