WooCommerce Product ID question. Can I change the product ID manually (in the database) or will that mess everything up?

I posted this in r/WooCommerce, but I never get any response there. Many more users here.

Is the product ID in multiple tables? That would obviously be a problem if I only changed it in one, but can. I change it in all related tables and effectively re-order my products? I am a tad bit compulsive, and it is unsettling the way my product list is so “out of order”. I am sure I am the only person to have this affliction. I can keep swallowing the discomfort if I must. My fear is that it will build up and I will start needing outlets for the pent up frustration. I don’t want to start kicking puppies or something. Maybe I can seek a good therapist to help me, if I must. I think re-ordering the products would be cheaper though, if it is possible.

I suppose I could also use the import/export functions to move the data to a spreadsheet, then delete everything and import it all back in the correct order. Seems like a reasonable solution, but certainly not the fastest if I can do it with phpMyAdmin.

  1. ID’s aren’t meant to be changed, or managed by users. That being said, you can, if you change all references to it as well, and keep the number of rows the same.

    TBH, your reason for wanting to do this, is a bit stupid, and a waste of your time. Consider Shopware, where sequential ID’s aren’t even a thing. It’s all GUIDs.

  2. Depends on what other WooCommerce plugins your site is using & if there are any tables in any of those pluginsthat use the product ID. If you can identify each table using the product id then you can pretty much do it programatically using PHP

  3. This would be a ridiculous task.

    The way WordPress’ database tables are setup means that all posts (posts, products, custom post types etc…) are added to the wp_posts table. They all get added into that table and the ID assigned to them is sequential, as well as matches the actual row ID (someone correct me if I’m wrong there, but I’m pretty sure that’s the case).

    Adjusting a product ID manually would require you adjusting that ID across numerous tables where that product is referenced (e.g. attributes, posts, post meta, product lookup tables etc…).

    If you want to change the order of some products just use the built-in feature to re-order products. Their ID is irrelevant since the order is defined via a separate field.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer