awesomemotive / easy-digital-downloads

Sell digital downloads through WordPress
https://easydigitaldownloads.com
GNU General Public License v2.0
868 stars 473 forks source link

Tax rate applying to entire country when country wide option not checked #8271

Closed brianleejackson closed 2 years ago

brianleejackson commented 3 years ago

Bug Report

Expected behavior

I'm using the EU VAT plugin on my sites to charge VAT. Ran into an issue where there was a specific province that shouldn't be charged VAT: Las Palmas. This is located in the Canary Islands which is exempt from VAT (source).

In EDD, I went to the Tax Rates table and added Spain as the country and Las Palmas as the province. I then entered 0% for the tax rate. This means Las Palmas shouldn't get charged taxes, and Spain should resort back to what the EU VAT plugin is setting.

image

Actual behavior

The problem is that now the entire country of Spain doesn't get charged tax. I can confirm the "Apply to whole country" box is not checked. This won't work since most of Spain is under EU law for VAT, it's just a few provinces that should be excluded. So it appears the option provided doesn't seem to work as expected. It seems to just be applying it to the whole country regardless.

Information (if a specific version is affected):

PHP Version: 7.4

EDD Version: 2.9.26 Easy Digital Downloads - EU VAT Version: 1.3.2

WordPress Version: 5.6

Any other relevant information:

I reached out to the Barn2 Media team first and they said this was most likely a bug with EDD.

cklosowski commented 2 years ago

We need to try and replicate this in EDD 3.0 with the new tax rate system and work @robincornett has done in #9294

robincornett commented 2 years ago

Our logic does not currently allow for intentionally applying a 0% regional tax rate. I expect the thought was that a 0% rate would exist by mistake but this use case makes sense.

It feels a little wrong to allow a 0% tax rate to be applied in general as I would normally consider that someone would have entered that amount by mistake, but if it is a mistake, then the rate can be easily deactivated. Possibly we could consider adding a confirmation step if someone enters a 0% rate, similar to the alert if they try to enter a duplicate rate, but still allow the empty rate to be added. And then yes, I think we should update this code to allow for the empty rate to be used.