fix(medusa): Check for Sales Channel on product import (#2202)
This commit is contained in:
@@ -341,12 +341,18 @@ class ProductImportStrategy extends AbstractBatchJobStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
channel = (await salesChannelServiceTx.retrieveByName(input.name, {
|
try {
|
||||||
select: ["id"],
|
channel = (await salesChannelServiceTx.retrieveByName(input.name, {
|
||||||
})) as SalesChannel
|
select: ["id"],
|
||||||
|
})) as SalesChannel
|
||||||
|
} catch (e) {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
salesChannels.push(channel)
|
if (channel) {
|
||||||
|
salesChannels.push(channel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return salesChannels
|
return salesChannels
|
||||||
@@ -382,7 +388,7 @@ class ProductImportStrategy extends AbstractBatchJobStrategy {
|
|||||||
) as unknown as CreateProductInput
|
) as unknown as CreateProductInput
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isSalesChannelsFeatureOn) {
|
if (isSalesChannelsFeatureOn && productOp["product.sales_channels"]) {
|
||||||
productData["sales_channels"] = await this.processSalesChannels(
|
productData["sales_channels"] = await this.processSalesChannels(
|
||||||
productOp["product.sales_channels"] as Pick<
|
productOp["product.sales_channels"] as Pick<
|
||||||
SalesChannel,
|
SalesChannel,
|
||||||
|
|||||||
Reference in New Issue
Block a user