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 < 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

Similar Posts