Skip to content

Incorrect Backorder Quantity Handling When Adding Same Product to Cart With Different Custom Options #3446

@rutvik-monpara

Description

@rutvik-monpara

Preconditions (*)

  • Inventory Metapackage Version: 1.2.8-p3
  • Product Type: Simple with Custom Options
  • Advanced Inventory > Backorders = Allow Qty Below 0 and Notify Customer

Steps to reproduce (*)

  • Create a simple product with custom options.
  • Set product stock quantity to 10.
Image
  • Enable backorders: Catalog > Products > Advanced Inventory > Backorders > Allow Qty Below 0 and Notify Customer
  • On frontend, add the same product to the cart twice, each with a different custom option. For each cart item, set quantity to 20.
Image

Expected result (*)

Cart should show correct stock/backorder distribution per line item:

  • First cart item:
    • Qty ordered: 20
    • Available qty: 10
    • Backordered qty: 10
  • Second cart item:
    • Qty ordered: 20
    • Available qty: 0
    • Backordered qty: 20
  • Total ordered qty: 40
  • Total available qty deducted: 10
  • Total backordered qty: 30
  • Admin order view should also reflect correct split per item.

Actual result (*)

  • First cart item shows:
    • Remaining / backordered qty = 10
  • Second cart item shows:
    • Backordered qty = 30
  • Instead of splitting based on remaining salable qty in stock, Magento assigns incorrect backorder calculation across cart items.
  • After order placement, admin order item quantities also show incorrect backorder distribution.
Image

Additional information

I did some research and found that in the file InventorySales/Model/GetBackorder.php, at line number 131, the variable $qtyToCheck is getting the combined total quantity of both products, whereas it should get separate quantities for each product. Because of this, the issue is occurring.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions