How to find your WooCommerce product ID

Code on screen

A product ID in WooCommerce is a number the WordPress system uses to identify a product in your store. When you create a product in WooCommerce, it will automatically get an ID. This works in a similar way to WordPress posts, which also have an ID.

You will rarely need the product ID itself. The only scenario where you need to know it is when you want to add some custom code (CSS or PHP) that should only be run for one specific WooCommerce product.

In this article, we’ll explain how you can find your product’s ID.

Finding the WooCommerce product ID through the WordPress admin dashboard

When you have access to the WordPress admin dashboard, finding the product ID is easy. In the dashboard, go to Products → All Products. In the list of products, hover your mouse over the product you need the ID from and it will appear below the product name. It’s small, but noticable:

Finding the product ID in WooCommerce

If you are surfing on a mobile device or tablet where hovering is not possible, click Edit and find the ID in the address bar of the Edit Product page:

The WooCommerce product ID in the URL

As you can see, the URL reveals all kinds of information, including the product’s ID.

Note that the techniques explained in this guide work for any type of WooCommerce product: simple, variable, grouped, or even external products.

Finding the WooCommerce product ID via the website

If you don’t have access to the WordPress admin dashboard, you can also find the product ID through your website’s source code.

In your browser, go to the product you need the ID of. You can get there from your site’s Shop page (usually located at yoursite.com/shop). Right click anywhere on the page and select View page source (specific for Chrome, but other browsers have something similar). This opens a new window with your page’s source code.

You can press CTRL+F to bring up the search bar, which allows you to search through the code. Enter <body in the search bar and the page jumps to a piece of code starting with <body. On that line, you’ll find the product ID. Here is a screenshot for your reference:

Find the WooCommerce product ID in the source code

Conclusion

That’s it! We’ve listed various ways to find a product ID in WooCommerce, both through the WordPress admin dashboard or via your site’s source code. It sounds technical, but it’s really easy!

Now that you have found it, you can use it to add custom code snippets to your website.

Share