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

hotfix(bp): only sync from select warehouse
This commit is contained in:
Sebastian Rindom
2021-03-25 17:18:22 +01:00
committed by GitHub

View File

@@ -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