From 6979cce59a02fda591d44ba2eb19959ea248181d Mon Sep 17 00:00:00 2001 From: Sebastian Rindom Date: Thu, 8 Oct 2020 15:44:57 +0200 Subject: [PATCH] fix(medusa-plugin-brightpearl): faulty fulfillments --- .../medusa-plugin-brightpearl/src/services/brightpearl.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/medusa-plugin-brightpearl/src/services/brightpearl.js b/packages/medusa-plugin-brightpearl/src/services/brightpearl.js index c9f00fb6af..66cced86d6 100644 --- a/packages/medusa-plugin-brightpearl/src/services/brightpearl.js +++ b/packages/medusa-plugin-brightpearl/src/services/brightpearl.js @@ -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 + ), } }