Merge pull request #217 from medusajs/hotfix/bp-warehouse-sync

hotfix(bp): only sync from select warehouse
This commit is contained in:
Sebastian Rindom authored and GitHub committed 2021-03-25 17:18:22 +01:00
commit 1cc1e38bb5
1 file changed
+10 -1
@@ -182,7 +182,16 @@ class BrightpearlService extends BaseService {
if (availability) {
const brightpearlProduct = await client.products.retrieve(productId)
const onHand = availability[productId].total.onHand
const prodAvail = availability[productId]
let onHand = 0
if (
prodAvail.warehouses &&
prodAvail.warehouses[`${this.options.warehouse}`]
) {
onHand = prodAvail.warehouses[`${this.options.warehouse}`].onHand
}
const sku = brightpearlProduct.identity.sku
if (!sku) return