Skip to content
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

Tax calculation error when Basis of product tax is set to store and Display prices with tax is on. #6384

Open
piloujp opened this issue Apr 7, 2024 · 11 comments · May be fixed by #6393
Open

Comments

@piloujp
Copy link
Contributor

piloujp commented Apr 7, 2024

In last GitHub version, with 'Basis of product tax' set to 'Store' and 'Display Prices with Tax' is set to 'true', and if store zone has not tax rate set.
When client zone (different from shop) has a tax rate set it will be used which is questionable... No tax should be applied in this case.
Then, if displaying prices with tax, tax is calculated as a 'gross price'. Displayed value is like 'actual tax - tax of the tax'...

For example:
Set shop zone to Alabama and 'Basis of Product Tax' to 'Shop', then 'Display prices with Tax' to true and customer address to Florida (where 7% tax apply).
Add product 25 'Microsoft keyboard' in cart and go through checkout.
Tax will be 4.58 instead of 4.90.
Strangely, 4.58 + (4.58 * .07) = 4.90...

When 'Display prices with Tax' is set to false, then tax is 4.90. But anyway in both case there should be no tax at all

@piloujp
Copy link
Contributor Author

piloujp commented Apr 11, 2024

Looking at this, I found something crazy...
In admin product edit page, gross and net prices are reversed!!!
It should be:
Gross ---> Tax excluded (without tax)
Net ---> Tax included (with tax)
I looked at the code and there is more than just inverted constant...
This might not be directly related to this issue but could explain the origin of the bug.

@piloujp
Copy link
Contributor Author

piloujp commented Apr 11, 2024

Revert prices had nothing to do with this issue.
See PR...

piloujp added a commit to piloujp/zencart that referenced this issue Apr 11, 2024
piloujp added a commit to piloujp/zencart that referenced this issue Apr 11, 2024
@drbyte
Copy link
Member

drbyte commented Apr 15, 2024

@piloujp wrote:
ZC is actually programmed to apply store tax (When tax basis is 'Store') only if client is in same zone. Then if client is in another zone, it applies client's zone tax (actually with error in calculation). If it is meant to be like this, then setting tax basis to store is exactly the same as setting it to shipping.

Hmmm ... I'd forgotten the "only if client is in same zone" part: I don't know why it got coded that way.

I "thought" that "Tax Basis: Store" meant: "use the Store's zone, regardless of customer/billing/shipping address/zone".

@drbyte
Copy link
Member

drbyte commented Apr 15, 2024

If using tax-included pricing, I can see how it's possible there may be a bug there, which might be related to incorrectly picking the applicable zone to use for adding tax back into the prices for display (again, because tax is never stored "in" the product price: it is always recalculated to add onto the base product price).

It really depends on what tax zone is selected for adding the tax back onto the price.
And that depends on both the Tax Basis setting, and then on the store's zone and/or how much zone data has been supplied by the customer yet ... and Zen Cart's displayed pricing will update accordingly as more and more detail is provided (ie: customer logs in, supplies an address, begins checkout, perhaps supplies alternate shipping and/or billing address, etc)

@dbltoe

This comment was marked as resolved.

@drbyte

This comment was marked as resolved.

@piloujp
Copy link
Contributor Author

piloujp commented Apr 16, 2024

I "thought" that "Tax Basis: Store" meant: "use the Store's zone, regardless of customer/billing/shipping address/zone".

Actually, me too, but looking at the code it is different.
And looking more closely at it, it makes sens. Many countries use only one sale tax (although there are always other tax rates for special cases). Setting tax basis to 'Store', you can easily apply this tax to the whole country. Then, you sale internationally without tax automatically.
For other cases like dbltoe one, tax basis set on 'Shipping' is the way to go (one tax rate, one zone for the world and nothing else).

@dbltoe

This comment was marked as resolved.

@drbyte

This comment was marked as resolved.

@piloujp

This comment was marked as resolved.

@dbltoe

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants