Update WooCommerce DB via Command Line
Last Updated -
NOTE: If you are on a shared hosting plan, please open a support ticket so that our support agents can assist you run this command via SSH.
In certain cases the Woocommerce plugin will update, but the WC database will fail to update. The failure of updating the database is usually caused by PHP timing out, especially on the shared hosting environment, since PHP only has 60 seconds to execute via a web request. The version mismatch between the WC database version and the WC plugin version can cause issues. To alleviate these issues, we can update the WC database via the command line.
1.) Log into the WP dashboard
Within the WP dashboard, you will see a message at the top which looks like this:
If you try to "run it now", usually the process will fail since you are hitting the 60 second max execution time.
2.) Go to the site's app root via SSH and run the WC update command
Run the command "wp wc update" to update the WC database. For a big DB this can take a some time to complete. Here is the output you should see to indicate the process completed:
wp wc update Calling update function: wc_update_320_mexican_states Calling update function: wc_update_320_db_version Success: 2 updates complete. Database version is 3.2.0