fix(medusa-plugin-brightpearl): faulty fulfillments

This commit is contained in:
Sebastian Rindom
2020-10-08 15:44:57 +02:00
parent e092e055f2
commit 6979cce59a

View File

@@ -593,7 +593,12 @@ class BrightpearlService extends BaseService {
if (row) {
return {
item_id: row.externalRef,
quantity: goodsOut.orderRows[key][0].quantity,
// Brightpearl sometimes gives multiple order row entries
quantity: goodsOut.orderRows[key].reduce(
(sum, next) => sum + next.quantity,
0
),
}
}