New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix number of orders under tax report #38525
Conversation
Test Results SummaryCommit SHA: da5ab47
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @octaedro thanks for digging into this, it looks like a fun one :)
I left a couple thoughts and suggestions on how to address this.
I think the underlying issue where the tax_rate is zero for Avatax is causing them all to loop together.
Speaking of tax_rate
it looks like in our Analytics > Taxes table we are relying to much on wp_woocommerce_tax_rates
table. So if a user deletes an old tax rate that data won't show up within the tax table in Analytics anymore. This is why when I enabled Avatax and deleted my other tax rates the table remained empty. As Avatax doesn't use the wp_woocommerce_tax_rates
table.
I think we may want to use similar logic as the legacy reports tax page when displaying tax rates.
plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php
Outdated
Show resolved
Hide resolved
plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @octaedro thanks for digging into this, it looks like a fun one :)
I left a couple thoughts and suggestions on how to address this.
I think the underlying issue where the tax_rate is zero for Avatax is causing them all to loop together.
Speaking of tax_rate
it looks like in our Analytics > Taxes table we are relying to much on wp_woocommerce_tax_rates
table. So if a user deletes an old tax rate that data won't show up within the tax table in Analytics anymore. This is why when I enabled Avatax and deleted my other tax rates the table remained empty. As Avatax doesn't use the wp_woocommerce_tax_rates
table.
I think we may want to use similar logic as the legacy reports tax page when displaying tax rates.
Might be related to what @louwie17 found... But I found this bug when displaying "Last month" (there were no orders on that time period): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested well, just left two minor comments, aside from that this will be good to go.
plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php
Outdated
Show resolved
Hide resolved
plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue I found previously was fixed.
I have no comments regarding the code, and it seems Lourens already made a thorough review of it, so I'm approving it.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Under
WooCommerce > Reports > Taxes
, the number of orders displayed is incorrect. Currently, it shows the count of applied taxes instead of the actual number of orders that are charging taxes.Before
After
Partially fixes issue 38347.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Avalara Avatax
.trunk
, rebuild the project, and refresh the page.