Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
107 stars 20 forks source link

How to disable taxes for shipping? #1475

Open myleshyson opened 6 years ago

myleshyson commented 6 years ago

It doesn't seem like there is a way to just disable taxes on shipping in woocommerce services. In Florida tax is only required when you charge both shipping AND handling. However when selecting shipping methods and leaving the handling price at 0, the automated taxes for woocommerce services still charges tax. We need a way to just totally disable taxes on shipping methods. Is there a way to do this?

Wordpress Version 4.9.8 Woocommerce Version 3.4.4 Woocommerce Services Version 1.15.1

myleshyson commented 6 years ago

Just in case anyone else needs to disable shipping tax with woocomerce automated taxes enabled, this is what I ended up doing.

Will there be an option in the future to disable shipping taxes from the admin?

add_action('woocommerce_package_rates', function ($rates, $package) {
    foreach ($rates as $rate) {
        $rate_tax = [];
        foreach ($rate->taxes as $key => $tax) {
            $rate_tax[$key] = 0;
        }
        $rate->taxes = $rate_tax;
    }
    return $rates;
});