Automattic / Automattic/woocommerce-services
Enabling automated tax deletes all stored tax rates
- Dominant language
- JavaScript
- Stars
- 112
- Forks
- 35
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 14
Description
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.

## 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](https://docs.woocommerce.com/wp-content/uploads/2013/02/us_tax_rates.csv)
4. In `Tax options`, set `Enable automated taxes` and save
5. Check `Standard rates` and view the table of rates – it will be empty.

## 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.
Contributor guide
Research direction
Reproduce the behavior from Settings > General and Settings > Tax > Tax options using the listed sample CSV, then trace the automated-tax setting change and the Standard rates table. Done means existing rates are not silently lost, or the user receives a clear warning before deletion; verify the full reproduction flow again.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100