Skip to content

Commit b0c6ec7

Browse files
committed
fix: Slug control is actived when the checkout is hosted by Commerce Layer
1 parent 52f074f commit b0c6ec7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pages/api/settings.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function isProduction(env: string): boolean {
2020
}
2121

2222
export default async (req: NextApiRequest, res: NextApiResponse) => {
23-
const { NODE_ENV, DOMAIN } = process.env
23+
const { NODE_ENV, DOMAIN, HOSTED } = process.env
2424
const accessToken = req.query.accessToken as string
2525
const orderId = req.query.orderId as string
2626
const domain = isProduction(NODE_ENV)
@@ -54,10 +54,11 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
5454

5555
if (
5656
isProduction(NODE_ENV) &&
57+
!!HOSTED &&
5758
(subdomain !== slug || kind !== "sales_channel")
5859
) {
5960
return invalidateCheckout()
60-
} else if (slug) {
61+
} else if (slug && kind === "sales_channel") {
6162
endpoint = `https://${slug}.${domain}`
6263
} else {
6364
return invalidateCheckout()

0 commit comments

Comments
 (0)