-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 process does not follow "Apply Tax On" setting #14469
Comments
Yes, That's correct. Apply Tax On setting not working. Any solution for this issue ? Thanks in advance, |
@iindranil I haven't submitted a PR for this issue, but I believe one solution is given in my closing statement of the issue description:
I happen to be working on this very issue today in my day job, so I may follow up with a diff or PR to reference when I come out of it. |
For example, I have added one product in my cart where product original price is $20 and I have set custom price $15. If I do the changes as per your solution on I want to sale item at $15 but want to add tax on $20 which is not working with your solution. Any idea ? Thank you, |
@iindranil I am continuing to research this issue in pursuit of a fix. As an update to the issue, I have one additional architectural comment. By design this method, being called mapItem and based on its DocBlock description, should not be modifying any properties on the given I am not sure it's worth fixing the method to adhere to the principle I outlined, but it's worth noting in case "the dog has to return to its vomit." |
Hi @vbuck , thank you for your report. |
@engcom-backlog-nazar I am not able to get to a PR at the moment, but in response to your update I wanted to share a diff I've had sitting around until I could come back to this issue: I noticed that you made a comment about not being able to reproduce, which I received via email. But by the time I came back to this issue the comment had changed. I'm guessing you were finally able to reproduce. Let me know if that diff above will solve your problem. If so, I'd be glad to open a PR over the weekend so that you can approve it. |
* [MAGETWO-91631](https://jira.corp.magento.com/browse/MAGETWO-91631) [Magento Cloud]Prefix in checkout not starting with blank value * [MAGETWO-95836](https://jira.corp.magento.com/browse/MAGETWO-95836) [Magento Cloud] If a product has a custom attributes which requires a Unique Value, it cannot be saved when there's an active Scheduled Update * [MAGETWO-96852](https://jira.corp.magento.com/browse/MAGETWO-96852) [2.3.x] Impossible to sort Root Categories via drag'n'drop * [MAGETWO-96421](https://jira.corp.magento.com/browse/MAGETWO-96421) [2.3.x] Header Minicart ,Shopping cart page and Checkout page show incorrect product name * [MAGETWO-95812](https://jira.corp.magento.com/browse/MAGETWO-95812) Required RMA Attributes are not validated while Customer submits a return * [MAGETWO-95186](https://jira.corp.magento.com/browse/MAGETWO-95186) [2.3] Incorrect table rates shipping charge at check out with cart price rule * [MC-4316](https://jira.corp.magento.com/browse/MC-4316) Tax calculation process does not follow "Apply Tax On" setting - GitHub #14469 * [MAGETWO-96545](https://jira.corp.magento.com/browse/MAGETWO-96545) Wrong calculation of invoiced items in shipment document in order with bundle product after partial invoice * [MC-10963](https://jira.corp.magento.com/browse/MC-10963) Can only export default store view items when upgrade to 2.3.0 * [MAGETWO-64324](https://jira.corp.magento.com/browse/MAGETWO-64324) WebAPI: product "has_options" flag not updated when options added via API * [MC-10938](https://jira.corp.magento.com/browse/MC-10938) 2.3.0 - clearing pub/static makes me login 3 times * [MC-10944](https://jira.corp.magento.com/browse/MC-10944) [B2B] My Quote disappears from Customer account when FPC is on * [MC-5542](https://jira.corp.magento.com/browse/MC-5542) Fix testOutputErrorsWithMessageCategoryAndTrace on PHP 7.2 * [MAGETWO-58841](https://jira.corp.magento.com/browse/MAGETWO-58841) API call with pageSize and currentPage > items should return error
Hello @vbuck Thank you for contribution and collaboration! The corresponding internal ticket Delivered to Delivered to |
Tax is not correctly calculated when "Apply Tax On" option is set to "Original price only." Tax is always based on item calculation price (custom price).
Preconditions
US Dollar
US Dollar
Total
Shipping Address
Taxable Goods
Original price only
Steps to reproduce
Expected result
Actual result
Additional Information
Class
Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector
is the underlying processor for the total and subtotal tax collectors. This class declares methodmapItem
, and this method is responsible for converting quote items into a more specific instance ofMagento\Tax\Api\Data\QuoteDetailsItemInterface
. Lines 216-228 determine the unit price of the given item:My understanding is as follows:
tax_calculation_price
via magic getter (note: no implementation found)calculation_price
via methodAbstractItem::getCalculationPriceOriginal
Given the name "tax calculation price," it can be assumed that any modifications to the calculation price should be made here for the sake of tax-specific constraints. Yet, there are none made. Instead the original calculation price is used as-is.
This becomes problematic under the following conditions:
AbstractItem::setCustomPrice
is used; and,These conditions cause the
mapItem
method to incorrectly refer to a price that is different from the originating product's base price. That is, a custom price. Furthermore, the "Apply Tax On" setting itself appears to be unused in the core altogether. There are even helper methods inMagento\Tax\Helper\Data
,applyTaxOnCustomPrice
andapplyTaxOnOriginalPrice
, which appear to be useful to this mapping process.I believe the solution is to conditionally fall back to
AbstractItem::getCalculationPriceOriginal
only when the setting "Apply Tax On" is set to "Custom price if available." Otherwise, if set to "Original price only," then the tax calculation price must be derived fromAbstractItem::getBaseOriginalPrice
.The text was updated successfully, but these errors were encountered: