Home > WooCommerce > How to Get WooCommerce Order Details?

How to Get WooCommerce Order Details?

As we know that, WooCommerce is the most popular platform for eCommerce solutions, and it already has by default templates of each page with the default template design.

So, sometimes we want to change the design of the template with our custom template and in that template, we need order details to show as per custom design.

Let’s get started.

Get WooCommerce Order Details

We have to send in the custom email body content. So there, we have to use the WC_Order object to get WooCommerce order details.
We can also use the wc_get_orders(), this is function to get the order object and get the order details on certain parameter.

So, we see how to get WooCoomerce order details with the help of getter method. You can check more method here.

If you want to get and access the protected data of the order object then, you can use the get_data() function.

It is the same as we did above with the instance of the $order object. E.g: $order->get_data()

It will return the data as an associative array and we can use this array with key=>pair value.

Let’s see the example.

With the get_data() function you can use order data as a array properties for get WooCommerce order details.

You can also loop the order items with get_items() function, if you have multiple items in one order.

See the simple example to understand this.

Here, we loop the order items and get the value with getter method, as we used in above.

So in this article we work with:





I hope you understand! how to get WooCommerce order details and use it?

Photo of author

About Aman Mehra

Hey there! I'm Aman Mehra, a full-stack developer with over six years of hands-on experience in the industry. I've dedicated myself to mastering the ins and outs of PHP, WordPress, ReactJS, NodeJS, and AWS, so you can trust me to handle your web development needs with expertise and finesse. In 2021, I decided to share my knowledge and insights with the world by starting this blog. It's been an incredible journey so far, and I've had the opportunity to learn and grow alongside my readers. Whether you're a seasoned developer or just dipping your toes into the world of web development, I'm here to provide valuable content and solutions to help you succeed. So, stick around, explore the blog, and feel free to reach out if you have any questions or suggestions. Together, let's navigate the exciting world of web development!

Leave a Comment