• I have developed a Python software for massive processing of products from an excel or xml file in dropshipping shops.

    I would like to add a new functionality to perform a maintenance to the database and, every six months, delete all the products to reload them.

    How can I reset the product ID to start from the first number?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey @lk2_89,

    WooCommerce Product IDs use the WordPress post ID that’s shared across the content types on the site. Unless all of the content is completely deleted from the site, there wouldn’t be a way to start over at 1.

    You could reset the auto-increment starting number after performing this maintenance. You could use a SQL statement like this:

    
    ALTER TABLE wp_posts AUTO_INCREMENT = 10000;
    ALTER TABLE wp_post_meta AUTO_INCREMENT = 10000;
    

    You would just need to make sure that’s higher than the previously highest assigned ID number. Again this would affect all content types: pages, posts, products, orders, and so on. It does not only affect products since they share the post table.

    If you have any questions, let us know.

    Cheers

    Plugin Support abwaita a11n

    (@abwaita)

    Hi @lk2_89,

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. Hopefully, the above info was helpful!

    If you have further questions, please feel free to open a new topic.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to reset product ID’ is closed to new replies.