chore(feature-flags): Sales Channels enabled by default (#2966)
This commit is contained in:
@@ -4,7 +4,8 @@ import {
|
||||
ProductTag,
|
||||
ProductType,
|
||||
ShippingProfile,
|
||||
ShippingProfileType
|
||||
ShippingProfileType,
|
||||
Store
|
||||
} from "@medusajs/medusa"
|
||||
import faker from "faker"
|
||||
import { Connection } from "typeorm"
|
||||
@@ -56,6 +57,21 @@ export const simpleProductFactory = async (
|
||||
await simpleSalesChannelFactory(connection, salesChannel)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
const store = await manager.findOne(Store, {
|
||||
relations: ["default_sales_channel"],
|
||||
})
|
||||
|
||||
if (store?.default_sales_channel) {
|
||||
sales_channels = [store.default_sales_channel]
|
||||
} else {
|
||||
const salesChannel = await simpleSalesChannelFactory(connection, {
|
||||
id: `default-${Math.random() * 1000}`,
|
||||
is_default: true,
|
||||
})
|
||||
|
||||
sales_channels = [salesChannel]
|
||||
}
|
||||
}
|
||||
|
||||
const prodId = data.id || `simple-product-${Math.random() * 1000}`
|
||||
|
||||
Reference in New Issue
Block a user