magento2
magento2 copied to clipboard
Float value calculation not returning exact zero
Preconditions and environment
- Magento: 2.4.6-p4
- PHP: 8.1
- Simple product having price $83.99
- A 100% discount coupon code also applicable on shipping amount
- Flat shipping with rate $205.98
Steps to reproduce
Frontend/Backend
- Add the Simple Product which having price $83.99
- apply coupon code (100% discount)
- select flat shipping method ($205.98)
- Observe the order total it will be Zero
- Place the order
Backend
- Open the order detail page
- Click on the Invoice
- Select the checkbox to create a shipment
- fill the tracking details
- Submit the Invoice
Expected result
Order must be "Completed" State : complete and Status : Completed
Actual result
Order is getting "Closed" State : closed and Status : Closed
Additional information
File Path : vendor/magento/module-sales/Model/Order/Invoice/Total/Shipping.php Line no: 41 $invoice->setGrandTotal($invoice->getGrandTotal() + $orderShippingAmount);
$invoice->getGrandTotal() + $orderShippingAmount returns a float 2.8421709430404E-14
Release note
No response
Triage and priority
- [X] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @mack4hack. Thank you for your report. To speed up processing of this issue, 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.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :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.
Hi @engcom-Bravo. 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:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-develop
branchDetails
- Add the comment@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-develop
branch, please, add the labelReproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmed
once verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
@magento give me 2.4-develop instance
Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Bravo, here is your Magento Instance: https://71611cbd69c3dd715b84f59cfc2471c1.instances-prod.magento-community.engineering Admin access: https://71611cbd69c3dd715b84f59cfc2471c1.instances-prod.magento-community.engineering/admin_032e Login: e54890f2 Password: ef036e1ae257
Hi @mack4hack,
Thank you for reporting and collaboration.
Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.
Steps to reproduce Frontend/Backend
Add the Simple Product which having price $83.99 apply coupon code (100% discount) select flat shipping method ($205.98) Observe the order total it will be Zero Place the order
Backend
Open the order detail page Click on the Invoice Select the checkbox to create a shipment fill the tracking details Submit the Invoice
Order is completed and status is also in completed state.
Kindly recheck the issue in Latest Magento 2.4-develop instance and elaborate the steps to reproduce if the issue is still reproducible.
Thanks.
@magento give me 2.4-develop instance
Hi @mack4hack. Thank you for your request. I'm working on Magento instance for you.
Hi @mack4hack, here is your Magento Instance: https://71611cbd69c3dd715b84f59cfc2471c1.instances-prod.magento-community.engineering Admin access: https://71611cbd69c3dd715b84f59cfc2471c1.instances-prod.magento-community.engineering/admin_44bd Login: f7a061b0 Password: 3ed71a6b835e
@magento give me 2.4.6-p4 instance
Hi @mack4hack. Thank you for your request. I'm working on Magento instance for you.
Hi @mack4hack, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
Hi @engcom-Bravo , Thanks for checking the issue, I am not able to reproduce it on 2.4-develop instance. I will try to verify it on 2.4.6-p4 instance and share the details
@magento give me 2.4.6-p4 instance
Hi @mack4hack. Thank you for your request. I'm working on Magento instance for you.
Hi @mack4hack, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento give me 2.4.6-p4 instance
Hi @mack4hack. Thank you for your request. I'm working on Magento instance for you.
Hi @mack4hack, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@engcom-Bravo can you please check this issue on Magento 2.4.6-p4 version ?
Hi @mack4hack,
Thanks for your update.
It is recommended to verify the issues in latest Magento 2.4-develop instance.it might be possible issue has been fixed in Latest branch.
Thanks.
@magento I am working on it
Hi @tushardatar7! :wave:
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team
command to join Contributors team.
@magento add to contributors team
Hi @tushardatar7! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.
@magento I am working on it
@magento give me 2.4-develop instance
Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Bravo, here is your Magento Instance: https://71611cbd69c3dd715b84f59cfc2471c1.instances-prod.magento-community.engineering Admin access: https://71611cbd69c3dd715b84f59cfc2471c1.instances-prod.magento-community.engineering/admin_2170 Login: 69ad5b54 Password: 46412399501c
Hi @tushardatar7,
Thanks for your contribution for creating the PR.
We have verified the issue in Latest 2.4-develop instance as it is recommended and the issue is not reproducible.kindly refer the screenshots.
The order status is completed.Could you please try to reproduce the issue in Magento 2.4-develop instance.
Thanks