How to Completely Uninstall WP-e-commerce shopping cart plugin.

I've been working on two sites to bring forward a shop. One of the sites is solely based on wp-e-commerce and wordpress and the shop functions will be in a catalog format. The other site will only have shopping functions, like "add to cart" or "buy now".

I have to do testing a lot to make sure nothing is breaking as I make changes. Here are the steps I've taken to completely uninstall wp-e-commerce whenever I need to start the installation or configuration from scratch in order to test something. This is specifically for WP 2.8.5, using the 3.7.4 stable version of wp-e-commerce.

There are three steps to completely uninstalling wp-e-commerce ((This is strictly for the 3.7.4 version)).

  1. deactivate the plugin & delete the files from your host.
  2. find the options and tables to delete in MySQL.
  3. remove the stuff from the database

The forums at Instinct have a lot of information, in there I found the basis to uninstalling the plugin completely.

Anyway, after you've uninstalled and deleted the plugin.. lets find the options and tables to delete in MySQL.

To get the rows that got inserted into the wp-options table, run this ((you'll have to change some values like username, password, database and prefix)):

mysql -uuser -ppassword -e "select * from wp_options;" database > remove.wpsc.options.sql
cat remove.wpsc.options.sql | awk '{print $3}' > new.rows.txt &&  mv new.rows.txt remove.wpsc.options.sql

Then you need to delete many rows in this txt file. As a general rule I found that wp-e-commerce adds all its rows into the wp_options table adjacent to each other. You should remove everything before the first row, and everything after the last row of options. These are: widget_wpsc_categorisation and user_account_url respectively, as of 3.7.4 I had 51 rows in there. I ended up with a file that had this in it:

widget_wpsc_categorisation
wpsc_purchaselogs_fixed
wpsc_version
country_form_field
email_form_field
wpsc_minor_version
show_thumbnails
product_image_width
product_image_height
category_image_width
category_image_height
product_list_url
shopping_cart_url
checkout_url
transact_url
payment_gateway
cart_location
currency_type
currency_sign_location
gst_rate
max_downloads
display_pnp
display_specials
do_not_use_shipping
postage_and_packaging
purch_log_email
return_email
terms_and_conditions
google_key
google_id
default_brand
wpsc_default_category
product_view
add_plustax
nzshpcrt_first_load
show_categorybrands
paypal_business
paypal_url
paypal_ipn
paypal_multiple_business
paypal_multiple_url
product_ratings
wpsc_email_receipt
wpsc_email_admin
wpsc_selected_theme
single_view_image_height
single_view_image_width
wpsc_gallery_image_height
wpsc_gallery_image_width
custom_gateway_options
wpsc_category_url_cache
user_account_url

I had to turn that into a sql statement file, in my case I'll name it drop.wpecommerce.options.sql
Assuming you have already cleaned your file up, and have just the rows for the wp-e-commerce options in the file, you can do some tweaks and fancy search & replacements, or just do it by hand, but make it look like this:

DELETE FROM wp_options WHERE option_name in ('widget_wpsc_categorisation','wpsc_version','wpsc_minor_version','show_thumbnails','product_image_width','product_image_height','category_image_width','category_image_height','product_list_url','shopping_cart_url','checkout_url','transact_url','payment_gateway','cart_location','currency_type','currency_sign_location','gst_rate','max_downloads','display_pnp','display_specials','do_not_use_shipping','postage_and_packaging','purch_log_email','return_email','terms_and_conditions','google_key','google_id','default_brand','wpsc_default_category','product_view','add_plustax','nzshpcrt_first_load','show_categorybrands','paypal_business','paypal_url','paypal_ipn','paypal_multiple_business','paypal_multiple_url','product_ratings','wpsc_email_receipt','wpsc_email_admin','wpsc_selected_theme','single_view_image_height','single_view_image_width','wpsc_gallery_image_height','wpsc_gallery_image_width','custom_gateway_options','wpsc_category_url_cache','user_account_url');

Save the above to a file named drop.wpecommerce.options.sql, we'll run it later along with the tables drop statements.

To get the tables that wp-e-commerce inserts and remove them, follow these steps ((you can put these into a script, as they are listed after you replace your own database, username and other values)):

# get the tables that are like wp_wpsc -- change this to your own prefix
mysql -uusername -ppassword -e "show tables like 'wp_wpsc%'" database > remove.wp-e-commerce.tables.sql

# replace the end of each line with a comma.
sed 's/$/,/g' remove.wp-e-commerce.tables.sql > new.file && mv new.file remove.wp-e-commerce.tables.sql

# remove the topmost line
sed '1d' remove.wp-e-commerce.tables.sql > new.file && mv new.file remove.wp-e-commerce.tables.sql

# insert drop table statement
sed '1i\
DROP TABLE' remove.wp-e-commerce.tables.sql > new.file && mv new.file remove.wp-e-commerce.tables.sql

# add semi-colon at the end of line
sed '$s/\,/\;/g' remove.wp-e-commerce.tables.sql > new.file && mv new.file remove.wp-e-commerce.tables.sql

#Run the command against MySQL, run the one for options as well.
mysql -uusername -ppassword database 

This seems to work for me allowing me to install wp-e-commerce from scratch whenever I need to.

Please note, BIG DISCLAIMER. This will probably loose all your data in regards to a store. I use this when I need to test the installtion of wp-e-commerce from scratch. You should NOT run this against your production store, unless you know what you're doing. Also, I love this plugin, I should mention that I'm only uninstalling it because I'm doing constant testing.

If you need help uninstalling a newer or older version of the plugin, please let me know. I can probably help you but I haven't gotten around to update this article

29 Comments

  1. Amazing job that saved me time doing a fresh install. This should be a sticky at the plugin support forum.

    Thanks again!

    • Hi Sam!
      Thanks for stopping by, and thanks for the tip. I posted it on the forums just a couple min ago. I hope it helps others too, thanks for stopping. Have a good one!

      nice site you got there BTW!

  2. Amazing job that saved me time doing a fresh install. This should be a sticky at the plugin support forum.

    Thanks again!

    • Hi Sam!
      Thanks for stopping by, and thanks for the tip. I posted it on the forums just a couple min ago. I hope it helps others too, thanks for stopping. Have a good one!

      nice site you got there BTW!

  3. I wish there was a way to just reset the store (db tables) to their initial states without having to uninstall/delete the tables etc…

  4. I wish there was a way to just reset the store (db tables) to their initial states without having to uninstall/delete the tables etc…

  5. I hear you, which reminds me. I should also update this with the latest version available.

    • Yes, please do! I am pulling my hair after desperately trying to uninstall version 3.7.6.2 from a test install of WP 2.9.2. Removing the plugin via the WP interface didn’t remove any of the DB tables. I dropped all the WPSC_ tables, and just did a mass delete on the WP_OPTIONS table based on all the “add_option” calls I found in install_and_update.php.

      Still I have a Products Page item in my site menu, which for the life of me I cannot get rid of!!

      Any pointers very welcome. Thanks in advance. For reference, I am including the DELETE statement with all options added by this version.

      DELETE FROM wp_options WHERE option_name in ('wpsc_purchaselogs_fixed','wpsc_version','show_thumbnails','product_image_width','product_image_height','category_image_width','category_image_height','product_list_url','shopping_cart_url','checkout_url','transact_url','payment_gateway','cart_location','cart_location','cart_location','cart_location','show_categorybrands','currency_type','currency_sign_location','gst_rate','max_downloads','display_pnp','display_specials','do_not_use_shipping','postage_and_packaging','purch_log_email','return_email','terms_and_conditions','google_key','google_id','default_brand','wpsc_default_category','product_view','add_plustax','nzshpcrt_first_load','show_categorybrands','paypal_business','paypal_url','paypal_ipn','paypal_multiple_business','paypal_multiple_url','product_ratings','wpsc_email_receipt','wpsc_email_admin','wpsc_selected_theme','wpsc_category_url_cache','wpsc_incomplete_file_transfer');
      
      • OK, just found the mysterious entries in the WP_POSTS table and removed them, and now the menu items are gone. I still wonder why these didn’t show up in the Pages or Posts list in WP admin, but that’s a mystery to solve another day.

        Hope this helps, and sorry for the extremely long line in my previous message, which doesn’t look nice in your page layout 🙁

  6. I hear you, which reminds me. I should also update this with the latest version available.

    • Yes, please do! I am pulling my hair after desperately trying to uninstall version 3.7.6.2 from a test install of WP 2.9.2. Removing the plugin via the WP interface didn’t remove any of the DB tables. I dropped all the WPSC_ tables, and just did a mass delete on the WP_OPTIONS table based on all the “add_option” calls I found in install_and_update.php.

      Still I have a Products Page item in my site menu, which for the life of me I cannot get rid of!!

      Any pointers very welcome. Thanks in advance. For reference, I am including the DELETE statement with all options added by this version.

      DELETE FROM wp_options WHERE option_name in ('wpsc_purchaselogs_fixed','wpsc_version','show_thumbnails','product_image_width','product_image_height','category_image_width','category_image_height','product_list_url','shopping_cart_url','checkout_url','transact_url','payment_gateway','cart_location','cart_location','cart_location','cart_location','show_categorybrands','currency_type','currency_sign_location','gst_rate','max_downloads','display_pnp','display_specials','do_not_use_shipping','postage_and_packaging','purch_log_email','return_email','terms_and_conditions','google_key','google_id','default_brand','wpsc_default_category','product_view','add_plustax','nzshpcrt_first_load','show_categorybrands','paypal_business','paypal_url','paypal_ipn','paypal_multiple_business','paypal_multiple_url','product_ratings','wpsc_email_receipt','wpsc_email_admin','wpsc_selected_theme','wpsc_category_url_cache','wpsc_incomplete_file_transfer');
      
      • OK, just found the mysterious entries in the WP_POSTS table and removed them, and now the menu items are gone. I still wonder why these didn’t show up in the Pages or Posts list in WP admin, but that’s a mystery to solve another day.

        Hope this helps, and sorry for the extremely long line in my previous message, which doesn’t look nice in your page layout 🙁

  7. Hi Chris, sorry for not getting back to you earlier, but I’m glad you figured it out. And thanks for the reminder on this… I will be updating it soon. No worries on the code, I’ll try to fix it.

  8. Hi Chris, sorry for not getting back to you earlier, but I’m glad you figured it out. And thanks for the reminder on this… I will be updating it soon. No worries on the code, I’ll try to fix it.

  9. someone know how to use google API in wordpress ?

  10. someone know how to use google API in wordpress ?

  11. Worked perfectly! Thank you so much! Saved me so much time with this stupid plugin

  12. Well, this post with the simple 3 steps solved the problem..

    I removed all the tables starting with wpsc. After that still there was this f kng products-page. So I searched my mysql database for ‘products-page’ and deleted all rows (the word occured 9 times, in two different tables) were it was found.

    Many thanks. Wasted all evening with wp e commerce…

  13. I am having issues with the plugin in firefox… it freezes my browser when I try to navigate the store… Someone said it could be because i changed my image sizes and I changed them back but it is still not working.. I also replaced the default css file and that did not work… any idea’s?

  14. hi I am a relative newbe and I am not sure how to run the option cleaning sql code… is there a primer somewhere that explains how to do this? Thanks for your help…

  15. Hi,
    I am using the most recent versions of both WP and the wp e-commerce plugin. I foolishly installed this plugin on an existing site (which broke the site) and when I uninstalled, all the pages are directing to the homepage. Anyways, I am trying to uninstall and get the site back up again. When you say to “to get the rows that got inserted into the wp-options table, run this
    ((you’ll have to change some values like username, password, database
    and prefix)):” where do I put in my database info and what goes in the place of “-e”? Also, any recommendations on how I could incorporate this plugin into and existing site? Thank you very much for your time! Elisa

    • Hi Elisa, this is a tutorial that requires you to use the command line interface for MySQL. It’s not recommended if you don’t know how to use that part. Is your site still broken right now? I can help you if you give me a call or contact me. 

  16. This post assumes more knowledge about SQL that the average user I would say.

    I’m getting an error when I try to even run the first run of the SQL code you mentioned.

    When replacing -uuser and -ppassword,, what is the syntax?  What is the -e?  Do I need to delete the “database” line from that code if I am running the SQL query from within the database?

    Again, your post seems to be very helpful, but not to the average user like me.

    • You’re right Nathan, this is a little bit advanced. You need to run these commands from the command line interface for MySQL – They might work if you run them from phpMySQL which your host probably provides. Also, the steps are a little bit old but they should be able to guide you through the process. the “-e” part means “execute and exit” So we’re saying use this username and password, and “-e” this command. 

  17. I absolutely love you for writing this. You totally saved me. I made the mistake of installing WP Commerce on my hightest-traffic site at 11pm “just to try it out” and it broke all of my custom pages. I was flipping out and hating myself for not backing up first, about to chug a coffee and write off the next 24 hours of my life. You saved me from having to stay up all night troubleshooting and/or restoring from a day-old backup. Thank you so much. I can get a full night’s sleep tonight, and it’s all because you took the time to put this together.

  18. Sorry to dig back old thread. But do we have a simpler way just to reset the shopping cart to its initial state cz we always tried adding a few dummy products first.

Comments are closed.