fix(medusa-plugin-brightpearl): only update inventory levels that are out of sync
This commit is contained in:
1 parent
0cebcd2521
commit
db205bf790
1 file changed
+6
-3
@@ -138,9 +138,12 @@ class BrightpearlService extends BaseService {
|
||||
)
|
||||
const onHand = availability[productId].total.onHand
|
||||
|
||||
return this.productVariantService_.update(v._id, {
|
||||
inventory_quantity: onHand,
|
||||
})
|
||||
// Only update if the inventory levels have changed
|
||||
if (parseInt(v.inventory_quantity) !== parseInt(onHand)) {
|
||||
return this.productVariantService_.update(v._id, {
|
||||
inventory_quantity: onHand,
|
||||
})
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user