feat(medusa): Prevent default SC to be assign if the isolated product flag is enabled (#5037)

* feat(medusa): Prevent default SC to be assign if the isolated product flag is enabled

* Create breezy-fans-accept.md
This commit is contained in:
Adrien de Peretti
2023-09-13 10:36:55 +02:00
committed by GitHub
parent 973c79bef6
commit 7231f65833
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
feat(medusa): Prevent default SC to be assigned if the isolated product flag is enabled
@@ -3,6 +3,7 @@ import { NextFunction, Request, Response } from "express"
import { FlagRouter } from "@medusajs/utils"
import SalesChannelFeatureFlag from "../../loaders/feature-flags/sales-channels"
import { SalesChannelService } from "../../services"
import IsolateProductDomain from "../../loaders/feature-flags/isolate-product-domain"
/**
* Middleware that includes the default sales channel on the request, if no sales channels present
@@ -23,6 +24,8 @@ export function withDefaultSalesChannel(
if (
!featureFlagRouter.isFeatureEnabled(SalesChannelFeatureFlag.key) ||
// Do not attach the default SC if the isolate product domain feature flag is enabled
featureFlagRouter.isFeatureEnabled(IsolateProductDomain.key) ||
req.query.sales_channel_id?.length ||
req.get("x-publishable-api-key")
) {