magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.31k forks source link

Order Total is becoming negative value during checkout if discount is greater than Cart value #35162

Closed engcom-November closed 2 years ago

engcom-November commented 2 years ago

Preconditions (*)

  1. Magento 2.4-develop

Steps to reproduce (*)

  1. Create Cart Price Rule with Action "Fixed amount discount for Whole Cart" and amount $100
  2. Stores - Settings - Configuration - Sales - Tax - Calculation Settings - 'Apply Customer Tax' Set to "After Discount", Apply 'Discount On Prices' - "Including Tax" - Save Config
  3. Default Tax Destination Calculation - Germany
  4. Stores - Settings - Configuration - Sales - Shipping Methods - Enable Free Shipping
  5. Create 3 Tax Rules (Ex: US ex: 8.25% tax rate and Germany 2 rules : 19% and 7%) image
  6. Reindex and clear cache
  7. Create a Product so that whole cart value is < 100 . (Ex: Created product with amount $40)
  8. Front-end Login as Customer - Add Product to Cart
  9. Ship to US/Germany Address, Apply Discount - Payment Step

Expected result (*)

Order Total should become 0

Actual result (*)

Order Total is becoming negative value. On submitting the order, below error message is displayed. image


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 2 years ago

Hi @engcom-November. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @engcom-Delta. 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:

engcom-Delta commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-Delta. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-Delta, here is your Magento Instance: https://dacab05c4880d265767ee7799c1ef90a.instances.magento-community.engineering Admin access: https://dacab05c4880d265767ee7799c1ef90a.instances.magento-community.engineering/admin_3080 Login: 1089f396 Password: 77bf1a6c6335

engcom-Delta commented 2 years ago

Hi @engcom-November , We tried to reproduce the issue on Magento 2.4.Develop latest branch , issue is reproducible for Germany Country Whereas for US shipping address it did not show negative value during checkout. Hence confirming the issue .

Steps followed:

  1. Create Cart Price Rule with Action "Fixed amount discount for Whole Cart" and amount $100 Screenshot 2022-03-07 at 8 10 11 PM
  2. Stores - Settings - Configuration - Sales - Tax - Calculation Settings - 'Apply Customer Tax' Set to "After Discount", Apply 'Discount On Prices' - "Including Tax" - Save Config Screenshot 2022-03-07 at 8 43 51 PM
  3. Default Tax Destination Calculation - Germany Screenshot 2022-03-07 at 8 49 36 PM
  4. Stores - Settings - Configuration - Sales - Shipping Methods - Enable Free Shipping Screenshot 2022-03-07 at 7 50 03 PM
  5. Create more than one Tax Rule (Ex: US and Germany - 19% and 7%) Screenshot 2022-03-07 at 8 32 12 PM
  6. Reindex and clear cache
  7. Create a Product so that whole cart value is < 100 . (Ex: Created product with amount $40) Screenshot 2022-03-07 at 7 58 23 PM
  8. Front-end Login as Customer - Add Product to Cart
  9. Ship to US/Germany Address, Apply Discount - Payment Step Screenshot 2022-03-07 at 8 24 55 PM Screenshot 2022-03-07 at 8 10 46 PM Screenshot 2022-03-07 at 8 23 54 PM

Create more than one Tax Rule (Ex: US and Germany - 19% and 7%)

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2570 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

engcom-November commented 2 years ago

Issue will not be fixed and is cancelled with below reasons:

  1. During configuring, there is sufficient warning to the merchant that they are performing some configurations that could lead to problems. Being even more stringent and stopping the merchant from proceeding with their configuration would require substantial effort on definition and also implementation. We would probably have to check all prices in the catalogue to check if the minimum price was less than the total cart discount and also the combinations of the discount calculations including or not tax, as well as the tax calculations taking place after discount applied. Altogether, quite a complex scenario for what appears to be somewhat of an edge case caused by trying to configure the store incorrectly.
  2. During checkout: the value shown is < 0 and this does indeed look silly. But what could be a solution? Making the order amount to be zero when the order value total is <0? That could be a solution but it could imply that shoppers start to see zero value orders and order many items rapidly, thereby cleaning out the merchant for what is probably an error. So in this case, I would also err on the side of caution and keep the order from being completed. At least this way, the merchant does not run the risk of having unexpected zero-value orders and they should relook at their configuration and configure their store correctly, creating cart discounts which correspond with the minimum prices of their products.