WPprodigy / woocommerce-product-fees

Add additional fees at checkout based on products that are in the cart.
https://wordpress.org/plugins/woocommerce-product-fees/
Other
25 stars 19 forks source link

Add "Standard" tax class #12

Closed WPprodigy closed 7 years ago

WPprodigy commented 8 years ago

The standard class tax is currently missing from the dropdown.

daigo75 commented 8 years ago

Standard tax class was deliberately removed in commit 2203f42fca0b7ca726ad9e6c457f93781d620eb1](https://github.com/WPprodigy/woocommerce-product-fees/commit/2203f42fca0b7ca726ad9e6c457f93781d620eb1), because it was not working properly.

Why Standard Tax Rate doesn't work

There is a design flaw in how the "Fees Tax" option was handled. The "don't apply tax" option is given a tax class ID equal to an empty string. Such ID is already reserved by WooCommerce, for the Standard Rates (in the plugin it was assumed, incorrectly, that the Standard tax class had the "standard" ID). The same issue affects the tax calculation: when the tax class ID is empty, the plugin assumes that no tax should be applied, while the Standard rate should be used instead.

How to fix the issue

I prepared a patch that handles tax rates correctly. Pull request coming shortly.

WPprodigy commented 7 years ago

Fixed here https://github.com/WPprodigy/woocommerce-product-fees/commit/d49ea61346230bb0e988a4520bc322cd33c76d3d

And added additional feature here: https://github.com/WPprodigy/woocommerce-product-fees/commit/d49ea61346230bb0e988a4520bc322cd33c76d3d