fix(medusa): Correct inventory quantity calculation (#3881)

* initial fix

* add changeset
This commit is contained in:
Philip Korsholm
2023-04-19 15:43:55 +02:00
committed by GitHub
parent f132535056
commit 0d0e9bf206
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
Fix(medusa): inventory quantity calculations

View File

@@ -674,7 +674,7 @@ class ProductVariantInventoryService extends TransactionBaseService {
})
variant.inventory_quantity = locations.reduce(
(acc, next) => acc + (next.stocked_quantity || 0),
(acc, next) => acc + (next.stocked_quantity - next.reserved_quantity),
0
)