Skip to content

[Backport] Floating point overflows in checkout totals fixed #20652

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

suryakant-krish
Copy link
Contributor

Original Pull Request

#18185

Description

Round the total amount to 4 decimal places in \Magento\Quote\Model\Quote\Address\Total::setTotalAmount, to avoid floating point overflows

Fixed Issues (if relevant)

  1. Cart Total is NaN in some circumstances #18027: Cart Total is NaN in some circumstances
  2. ...

Manual testing scenarios

  1. Put two items in the cart, in our case this is one product at 59,80€ incl. Tax and one product at 9,49€ incl. Tax, Shipping is free
  2. Apply a coupon code (cart price rule) with 100% discount
  3. This usually results in a floating point overflow and the grand total coming as 1.4210854715202e-14 instead of 0
  4. After this fix, the grand total should come 0

@magento-engcom-team
Copy link
Contributor

Hi @suryakant-krish. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.2-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@milindsingh
Copy link
Member

Duplicate #20638

@sivaschenko
Copy link
Member

Thanks for the port @suryakant-krish , however, let's collaborate to deliver earlier port PR. Closing this pull request as a duplicate to #20638

@ghost
Copy link

ghost commented Jan 27, 2019

Hi @suryakant-krish, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@sivaschenko sivaschenko self-assigned this Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants