Your Dedicated Partner for All Things WordPress

How to Get WooCommerce Order ID

Table of Contents

In this tutorial, we will discuss how to get a WooCommerce order ID. What is an order ID? WordPress treats WooCommerce products as custom post types and assigns them unique numeral identifiers- IDs. Consequently, each order has a unique ID as well, so WordPress could distinguish them when selecting information from the database. Let us take a look at common methods on how the WooCommerce order ID can be found.

WooCommerce Order ID from Database

If you are somewhat familiar with the inner workings of databases, then you can quickly look up the order ID there. Login to your phpMyAdmin account and find the wp_posts table. You will see a dedicated ID column. Go over the database and find the order ID you need.

phpmyadmin wp_posts order id woocommerce

Keep in mind that your database might have a different prefix than wp_, so make sure that you change it accordingly.

WooCommerce Order ID with Plugins

You might not be familiar with databases so consider using plugins. There are several noteworthy plugins on the market at the moment. We will list a few of the popular ones that you can use in order to get the order ID displayed on your dashboard.

  • Reveal IDs – With the release of WordPress 2.5, all IDs for admin pages were removed due to the fact that the average user has no need for them. This open-source software brings back the functionality and you will be able to see IDs right next to WooCommerce orders.
  • Sequential Order Numbers Pro – This plugin allows you to number orders in any way you want. For instance, you can add a date and time to order IDs. A highly useful tool for managing WooCommerce orders.
  • Custom Order Numbers for WooCommerce – You can reset existing order IDs and create new ones according to your specifications. The most distinguishing feature is the ability to re-name existing order IDs.

WooCommerce Order ID via PHP

For customization purposes, there may be a need to display the WooCommerce product ID somewhere in the front-end, for instance, an e-mail to the customer to confirm a successful order. In order to achieve this, the order ID must first be included in the code so WordPress can use it in the functions. Take a look at the code below.

//Declare the global WooCoomerce Object & Post Object

global $woocommerce, $post;

//Assign the order ID using the $post->ID

$order = new WC_Order($post->ID);

// Use the getter function to get order ID


As you can see, you can use the last function to call upon the specific order ID.

Final Words

It is up to you to decide which one of these methods best suits your purpose. In web development, there is no such thing as only one correct answer. We wish you a bug-free journey through the world of eCommerce and stay tuned for more articles!

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

Looking for help? Chat with us.

Are you in need of assistance or guidance? Look no further! Our dedicated team is here and ready to help. Chat with us today and let’s work together to find the perfect solution for your needs.

Our support team will get you:

I believe every website owner deserves a reliable professional support always by their side.

Alexey Seryapin
Founder of WPServices

Having Troubles With WordPress?

Claim Your Free WordPress Maintenance

In today’s fast-paced digital landscape, every website deserves the care and expertise of a professional maintenance team, ensuring optimal performance, enhanced security, and seamless user experiences, so you can focus on growing your business with peace of mind.

Alexey Seryapin
Founder of WPServices

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices