WordPress Plugin Delete WooCommerce Tax Rates

About The Author
Cabe Nolan is the founder of WP Cover where he shares his insight into WordPress, development, & entrepreneurship. Outside of WPCover, Cabe continues to run a successful WordPress development firm, Bold City Design as well as a few high profile websites, Arrivala, Two Way Resume, Dock Skipper, and a successful outdoors brand, DolfinPack.

WordPress Plugin Delete WooCommerce Tax Rates

Over at Bold City Agency, one of our specialties is e-commerce development.  We work heavily with APIs to sync data from point of sale systems to WooCoomerce.  Often times, customers have complex tax calculations that must be calculated based on the zip code the shipment is going to.  When this is required, we will ask them for an Excel spreadsheet containing all the tax rates.  More often than not, the client needs to change the info (as there is always a small tweak) which presents a problem; WooCommerce has no way of clearing the tax rate table except through PHPMyAdmin or a similar tool.

ChromeOrange wrote a great custom function that truncates the database table for the tax rates.  All I did was wrap it into a quick plugin and save it for future use.  So I thought I would share.

Download The Plugin

Once you download, install, and activate the plugin, go to: WooCommerce -> System Status -> Tools. There will be a delete all tax rates button.

If you would prefer to add the custom function to your themes functions.php file, you can use the alternative:


 * Delete ALL WooCommerce tax rates
 * Add to your theme functions.php then go to woocommerce -> system status -> tools and there will be a delete all tax rates button http://cld.wthms.co/tXvp

add_filter( 'woocommerce_debug_tools', 'custom_woocommerce_debug_tools' );

function custom_woocommerce_debug_tools( $tools ) {
	$tools['woocommerce_delete_tax_rates'] = array(
		'name'		=> __( 'Delete Tax Rates',''),
		'button'	=> __( 'Delete ALL tax rates from WooCommerce','' ),
		'desc'		=> __( 'This tool will delete all your tax rates allowing you to start fresh.', '' ),
		'callback'  => 'woocommerce_delete_tax_rates'
	return $tools;

 * Delete Tax rates
function woocommerce_delete_tax_rates() {
	global $wpdb;
	$wpdb->query( "TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rates" );
	$wpdb->query( "TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rate_locations" );

	echo '<div class="updated"><p>' . __( 'Tax rates successfully deleted', 'woocommerce' ) . '</p></div>';

Share Your Thoughts

Leave a Reply

Your email address will not be published.

Related Stuff You Might Like

WordPress News, Tips, & Code Snippets

Join the WP Cover mailing list and get wordpress news, tips, code snippets, security warnings, and more delivered right to your inbox.  We won't flood your inbox, newsletters typically go out every 1-2 weeks unless it involves an important security release.

You have Successfully Subscribed!