It works fine when cart price discount does not apply on shipping price, or when applies but shipping price excludes tax.
Hi @pierzakp. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@pierzakp do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[x] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[x] 5. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
_Next steps are available in case you are a member of Community Maintainers._
[x] 6. Add label Issue: Confirmed once verification is complete.
[x] 7. Make sure that automatic system confirms that report has been added to the backlog.
Hi, I have created vanilla Magento 2.2.6 EE instance on Magento Cloud and after configuring all preconditions I am able to reproduce this issue.
Hi @pierzakp can you reproduce this on CE version ?
Please share 2.2.6 CE instance.
@magento-engcom-team give me 2.2.6 instance
Hi @engcom-backlog-nazar. Thank you for your request. I'm working on Magento 2.2.6 instance for you
Hi @engcom-backlog-nazar, here is your Magento instance.
Admin access: https://i-21456-2-2-6.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
@magento-engcom-team give me 2.3-develop instance
Hi @dipti2jcommerce. Thank you for your request. I'm working on Magento 2.3-develop instance for you
Hi @dipti2jcommerce, here is your Magento instance.
Admin access: https://i-21456-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
Thank you for sharing the instance. Issue has been reproduced with the same wrong values as output in order.
:white_check_mark: Confirmed by @engcom-backlog-nazar
Thank you for verifying the issue! :+1: Your confirmation will help us to acknowledge and process this report.
:white_check_mark: Confirmed by @engcom-backlog-nazar
Thank you for verifying the issue! :+1: Your confirmation will help us to acknowledge and process this report.
:white_check_mark: Confirmed by @engcom-backlog-nazar
Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-98435, MAGETWO-98436 were created
Issue Available: @engcom-backlog-nazar, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
Generally things goes wrong in:
vendor/magento/module-tax/Model/Calculation/AbstractAggregateCalculator.php:49
For test purpose I have replaced:
//TODO: handle originalDiscountAmount
$taxableAmount = \max($rowTotalInclTax - $discountAmount, 0);
$rowTaxAfterDiscount = $this->calculationTool->calcTaxAmount(
$taxableAmount,
$rate,
true,
false
);
$rowTaxAfterDiscount = $this->roundAmount(
$rowTaxAfterDiscount,
$rate,
true,
self::KEY_REGULAR_DELTA_ROUNDING,
$round,
$item
);
// Set discount tax compensation
$discountTaxCompensationAmount = $rowTax - $rowTaxAfterDiscount;
$rowTax = $rowTaxAfterDiscount;
With following:
$taxableAmount = \max($rowTotal - $discountAmount, 0);
$discountTaxCompensationAmount = 0;
$rowTax = $taxableAmount * ($rate / 100);
Then result is as expected.
@magento-engcom-team give me 2.1.16 instance
Hi @ryandiamond23. Thank you for your request.
Unfortunately, I can only deploy instances for 2.2 and 2.3 release lines
Hi @amol2jcommerce. Thank you for your request. I'm working on Magento 2.2-develop instance for you
Hi @amol2jcommerce, here is your Magento instance.
Admin access: https://i-21456-2-2-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
Hi @maheshWebkul721. Thank you for your request. I'm working on Magento 2.2.7 instance for you
Hi @maheshWebkul721, here is your Magento instance.
Admin access: https://i-21456-2-2-7.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
What is status of the issue?
To make follow up to everyone I received following responses from Magento EE support:
This behavior was implemented intentionally according to our design. When taxes are included for shipping and there is a shipping discount then Magento calculates discounted tax compensation in order to charge taxes for whole shipping amount. I understand this was done in order to comply with tax regulations.
As my colleague said, our core development team has reported that this behavior is as designed.
My understanding is there are plans to revisit this implementation in future releases, however it would require a great deal of architecture work. We do not have an ETA.
Our Core developers have said this is as designed and are not going to fix this for M2.2x or 2.3 at this time. The design will be revisited for future releases.
The github post will be updated with those results, but it hasn't been done yet.
Seems that we need to find workaround on our own.
Thanks for the update @pierzakp :).
When an administrator chooses "apply to shipping", the discount should be fully applied to the shipping. Discounted shipping does not mean, 'discounted, except for tax'. If perhaps it does for some countries, this behaviour should at be configurable. This is a disappointing response from Magento!
@pierzakp we are in communication with Magento EE for the issue but We don't get the information from them, still waiting for a solution. Could you share more detail about what you talked to them exactly?
To elaborate on the issue I'm having, which is similar to @tnsezer's in #22480
I have a cart price rule that is has an action of 100% discount and applies to shipping. All tax calculation rules are set to be 'including tax' and tax is set to be calculated after discount. Everything gets discounted, however I'm left with the tax on the shipping (which is 拢5, so 83p).
Turns out the issue I was having may be unrelated. We have a weird setup whereby simple products are in categories that their configurable is not. This messed up cart price rules based on categories.
We are experiencing the same issue. Shipping tax is not discounted when using a discount code. Have anyone solved this one yet?
Most helpful comment
Generally things goes wrong in:
vendor/magento/module-tax/Model/Calculation/AbstractAggregateCalculator.php:49For test purpose I have replaced:
With following:
Then result is as expected.