You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the confirmOrderEditRequestWorkflow, there's an issue where the allItems array can end up empty even when there are valid order items that should be processed. This prevents proper inventory reservation for order edits and can lead to unexpected behavior.
Expected behavior
Actual behavior
When processing order edits via the confirmOrderEditRequestWorkflow, the transform function responsible for preparing inventory reservation data may result in empty allItems and allVariants arrays. This occurs specifically in the section that calculates newQuantity and applies filtering logic:
When newQuantity evaluates to zero or negative, the item is skipped entirely.
Quantity Decrease: Any edit that decreases quantity will result in negative newQuantity and be filtered out.
Partially Fulfilled Orders: If an order is partially fulfilled and the remaining quantity is being modified, the calculation might not account for this correctly.
Multiple Sequential Edits: If multiple edits are performed in sequence, calculations might compound incorrectly. (only the last added are accounted - previous change reservation are deleted by deleteReservationsByLineItemsStep but not in accounted because order.items[x].actions[x] is now empty)
in case of ITEM_UPDATE the raw_quantity is already updated according to order.items[x].actions[x].details.quantity that lead to newQuantity = 0
Link to reproduction repo
na
The text was updated successfully, but these errors were encountered:
Package.json file
Node.js version
v20
Database and its version
16
Operating system name and version
linux
Browser name
chrome
What happended?
During the confirmOrderEditRequestWorkflow, there's an issue where the allItems array can end up empty even when there are valid order items that should be processed. This prevents proper inventory reservation for order edits and can lead to unexpected behavior.
Expected behavior
Actual behavior
When processing order edits via the confirmOrderEditRequestWorkflow, the transform function responsible for preparing inventory reservation data may result in empty allItems and allVariants arrays. This occurs specifically in the section that calculates newQuantity and applies filtering logic:
medusa/packages/core/core-flows/src/order/workflows/order-edit/confirm-order-edit-request.ts
Lines 207 to 269 in 0533269
Link to reproduction repo
na
The text was updated successfully, but these errors were encountered: