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[1].
- deactivate the plugin & delete the files from your host.
- find the options and tables to delete in MySQL.
- 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[2]:
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[3]:
# 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 < drop.wpecommerce.options.sql mysql -uusername -ppassword database < remove.wp-e-commerce.tables.sql
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
Footnotes:- This is strictly for the 3.7.4 version [source]
- you’ll have to change some values like username, password, database and prefix [source]
- you can put these into a script, as they are listed after you replace your own database, username and other values [source]
Possibly Related posts:
{ 8 comments… read them below or add one }
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!
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…
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
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.
someone know how to use google API in wordpress ?