Skip to content

Instantly share code, notes, and snippets.

@ChromeOrange
Last active February 25, 2020 04:22

Revisions

  1. ChromeOrange revised this gist Jan 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    /**
    * Delete ALL WooCommerce tax rates
    *
    * Add to your theme functions.php then go to woocommerce -> system status -> tools
    * 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' );
  2. ChromeOrange created this gist Jan 6, 2014.
    29 changes: 29 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    /**
    * Delete ALL WooCommerce tax rates
    *
    * Add to your theme functions.php then go to woocommerce -> system status -> tools
    */

    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>';
    }