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
108 stars 20 forks source link

Enabling automated tax deletes all stored tax rates #2471

Open joshheald opened 3 years ago

joshheald commented 3 years ago

This issue was discovered on support due to a user being unable to set their tax rates. 4283940-zen

Summary

When changing the Automated taxes setting from Disable automated taxes to Enable automated taxes, previously entered tax rates are deleted without warning.

Automated taxes setting

Repro

  1. Create a store and check Enable tax rates and calculations in Settings > General
  2. In Settings > Tax > Tax options, set Disable automated taxes and save
  3. In Standard rates, Import the CSV of sample tax rates
  4. In Tax options, set Enable automated taxes and save
  5. Check Standard rates and view the table of rates – it will be empty.

disabling-automatic-tax-doesnt-restore-rates

Discussion

I understand that these rates are most likely cleared when switching from standard to Automated tax calculations because they are treated as an override with the Automated calculation, and as the definition of all rates with the Standard calculation. I can imagine if they weren't cleared, it could cause issues for merchants thinking that they had automated tax, when they are actually still using their old manual rates whenever they apply.

However... this seems like a fairly destructive consequence to allow it to happen without warning. The table that someone has built up could be quite comprehensive and difficult to re-create.

I discovered this when supporting a new user with a very small US store, who would actually be well served by automated taxes as they are unlikely to currently have breached the economic nexus requirements in any other state. However, they thought they needed to charge sales tax in all states, and had put overrides in, then unintentionally had them deleted by changing the Automated taxes setting, possibly thinking they needed to "disable tax" before editing the rates, then enable it again when they were finished. When they found there were no rates saved and no tax charged for customers outside their state, they did not understand why their rates weren't saved.

frosso commented 3 years ago

@joshheald to clarify - before overwriting, the tax rates are backed up in the WP site's upload directory, in a CSV file with name taxjar-wc_tax_rates-{YYY-MM-DD}-{time}.csv, where {YYY-MM-DD} is the current date and {time} is the current Unix timestamp.

We already have the following statement in our documentation:

When Automated taxes are in use, this overrides any tax rates you have manually added, as well as the “Compound” and “Shipping” toggles for those tax rates.

I'm going to add a note about the CSV backup 👍

joshheald commented 3 years ago

Thanks @frosso The CSV backup note sounds good, however if it's only in the documentation it seems unlikely that folks will find them if they switch and find the rates gone.

The documentation will probably help HE's find the backups and resolve it for someone, but I do wonder whether it would be possible to help people avoid making a mistake here in the first place, perhaps with an alert warning them on changing that value if the've got manually added tax rates in place.

namiokuzono commented 1 year ago

@waclawjacek I would like to get some insight about this enhancement request.

Automated Tax works only for nexus location, and we promote usage of both Automated Tax + Standard Tax rates to cover nexus location and the rest of the location. (I.e. Your nexus location is CA, but you charge fixed rate for the rest of US + EU, etc)

Regardless of Standard Tax rates, it's true nexus location would be overwritten by Automated Tax rates, but the rest should stay.

I would love to advocate this to be taken a look once again, but possibly there is another reason why we keep this in the way we do. (REF: Troubleshooting like this scenario in 7964253-zd-a8c makes it challenging)

waclawjacek commented 1 year ago

Hi @namiokuzono!

I do not have the context on the introduction of this change. I imagine it was introduced just to be sure there are no conflicts, with the assumption that the automated tax rates will be the source of truth.

Right now, we display this description under the dropdown which enables automated taxes:

Screenshot 2024-04-02 at 14 58 36

I agree that the rest should stay. We could loop through the rates and check which ones would apply for the nexus, and then get rid of just these.

It could still be problematic if a tax rate applies to * countries and * states (so both within the nexus and outside of it). This would result in unexpected behavior for the merchant. I guess it's more user-friendly in the end if we do something more predictable - remove all rates but inform merchants of this.

I suppose we could leverage the "Priority" column and assign the automated rates high-priority so they effectively override manually-entered rates.

WDYT @laurajohnsonwoo? How could we improve this?