fix(order): Prevent fetching all db adjustments when no items are pre… (#14351)

* fix(order): Prevent fetching all db adjustments when no items are present

* Create funny-suns-think.md
This commit is contained in:
Adrien de Peretti
2025-12-18 15:21:32 +01:00
committed by GitHub
parent 7172995bde
commit fb6a6b52fa
2 changed files with 9 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/order": patch
---
fix(order): Prevent fetching all db adjustments when no items are pre…

View File

@@ -225,6 +225,10 @@ async function loadItemAdjustments(manager, orders) {
const items = orders.flatMap((r) => [...(r.items ?? [])])
const itemsIdMap = new Map<string, any>(items.map((i) => [i.item.id, i.item]))
if (!items.length) {
return
}
const params = items.map((i) => {
// preinitialise all items so an empty array is returned for ones without adjustments
if (!i.item.adjustments.isInitialized()) {