feat(medusa-plugin-restock-notifications): Multi-warehouse support (#4718)
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,14 @@ export default async (req, res) => {
|
||||
const restockNotificationService = req.scope.resolve(
|
||||
"restockNotificationService"
|
||||
)
|
||||
await restockNotificationService.addEmail(variant_id, req.body.email)
|
||||
|
||||
let sales_channel_id = req.body.sales_channel_id
|
||||
|
||||
if (req.publishableApiKeyScopes?.sales_channel_ids.length === 1) {
|
||||
sales_channel_id = req.publishableApiKeyScopes.sales_channel_ids[0]
|
||||
}
|
||||
|
||||
await restockNotificationService.addEmail(variant_id, req.body.email, sales_channel_id)
|
||||
res.sendStatus(201)
|
||||
} catch (err) {
|
||||
res.status(400).json({ message: err.message })
|
||||
|
||||
Reference in New Issue
Block a user