Search code examples
mysqlwordpresswoocommercewoocommerce-rest-api

Change next order number (post_id) woocommerce


I want to change the sequence of next new order number ( post_id ) in woocommerce because of some number conflicts with our accounting software who is integrated with woocommerce.

Our latest order number is 51249 and i want the next and newer to start with 70000.

Is it safe to run following sql query?: ALTER TABLE wp_posts AUTO_INCREMENT = 70000;


Solution

  • Your question has the solution.

    Yes, it is safe to increase AUTO_INCREMENT as long as you are sure you can never go back. The opposite (reducing) is not as easy and safe as increasing it. I would recommend you check the AUTO_INCREMENT value just in case before running the query.

    In conclusion, this is the correct answer to achieve what you asked. Remember making a backup before just in case.

    ALTER TABLE wp_posts AUTO_INCREMENT = 70000;