fix(medusa): getAvailableContext should first check if the inventory service is present (#4293)
* fix(medusa): getAvailableContext should first check if the inventory service is present * Create clever-seals-share.md
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(medusa): getAvailableContext should first check if the inventory service is present
|
||||||
@@ -820,6 +820,10 @@ class ProductVariantInventoryService extends TransactionBaseService {
|
|||||||
products: (Product | PricedProduct)[],
|
products: (Product | PricedProduct)[],
|
||||||
salesChannelId: string | string[] | undefined
|
salesChannelId: string | string[] | undefined
|
||||||
): Promise<(Product | PricedProduct)[]> {
|
): Promise<(Product | PricedProduct)[]> {
|
||||||
|
if (!this.inventoryService_) {
|
||||||
|
return products
|
||||||
|
}
|
||||||
|
|
||||||
const variantIds: string[] = products
|
const variantIds: string[] = products
|
||||||
.flatMap((p) => p.variants.map((v: { id?: string }) => v.id) ?? [])
|
.flatMap((p) => p.variants.map((v: { id?: string }) => v.id) ?? [])
|
||||||
.filter((v): v is string => !!v)
|
.filter((v): v is string => !!v)
|
||||||
|
|||||||
Reference in New Issue
Block a user