-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Use tax location from order while computing tax in discount. #26983
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
Conversation
|
@vedanshujain This might not be related to this PR but some of the tax calculations remain local to the shop. Shop is in NB (15% HST). Customer is in the US (10%). |
|
@rrennick Sorry for the late reply, this somehow skipped me. Can you please post more detailed steps, I tried creating a manual order with a guest customer, and always rates depending upon customer's billing address are being picked. |
Was that from the dashboard or an checkout in an incognito window? |
This is manual order from dashboard using admin account, but creating order for a guest user. |
I was following the testing instructions. |
We were not passing tax location while computing discount in orders, hence it was defaulting to shop's base address resulting in incorrect tax calculation. This commit refactors `get_rates` method into another method that allows getting rates from location directly.
This method will prioritize getting rates from billing/shipping address instead of `WC()->customer` which in irrevelant in context of editing order from admin screen.
bfd20a0 to
a2231c4
Compare
|
@rrennick I am not able to reproduce the issue you are mentioning, I always seeing the correct taxes applied with this fix. Perhaps some setting somewhere is taking the base shop tax? |
@vedanshujain Sorry for the delay in responding. I'm not seeing the issue now either. |
claudiosanches
left a comment
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.
Great work!

All Submissions:
Changes proposed in this Pull Request:
We were not passing tax location while computing discount in orders, hence it was defaulting to the shop's base address resulting in incorrect tax calculation.
This was causing #25082 since the order's address is not passed, it was defaulting to address with what current admin user had.
This commit refactors
get_ratesmethod into another method that allows getting rates from the location directly.Closes #25082.
How to test the changes in this Pull Request:
US, then enter prices forIndia(@25%), make sure that there is no other tax applied like so:IndianaddressIn above case, after the patch, the discount should be 19.36 (193.6 @ 10%), whereas before this patch discount will be 24.20 (242.2 @ 10%, which is incorrect as in this case, discount on tax will be applied twice).
Other information:
Changelog entry