Skip to content

Qty to ship and Qty to invoice are handling decimals poorly #14328

@barbazul

Description

@barbazul

When working with products set up with is_qty_decimal, getQtyToShip and getQtyToInvoice sometimes return wrong values and cause orders to not be able to be completed

Preconditions

  1. Have a product setup to use decimal qty

Steps to reproduce

  1. Complete an order with a product using qty = 4.4
  2. Create an invoice for qty = 0.4
  3. Refund the invoice
  4. Create an invoice for qty = 4
  5. Create a shipment for qty = 4

Expected result

  1. Order is complete

Actual result

  1. Order is not complete because there is a qty = 3.3306690738755E-16 (that's 16 decimal positions) pending shipment

Overall float point numbers are handled poorly in all order qty operations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions