mirror of
https://github.com/vercel/commerce.git
synced 2025-05-07 10:17:50 +00:00
bug fix
This commit is contained in:
parent
c8f23ec4e3
commit
9ab458fa33
@ -199,8 +199,26 @@ export async function updateItemQuantity(
|
||||
}
|
||||
|
||||
export async function redirectToCheckout() {
|
||||
let cart = await getCart()
|
||||
redirect(cart!.checkoutUrl)
|
||||
const cart = await validateAndGetCart()
|
||||
|
||||
if (!cart.checkoutUrl) {
|
||||
throw new Error('Missing checkout URL')
|
||||
}
|
||||
|
||||
let url = cart.checkoutUrl
|
||||
|
||||
// 開發環境下的 URL 修正
|
||||
if (
|
||||
process.env.NODE_ENV === 'development' &&
|
||||
url?.startsWith('http://linconson.com')
|
||||
) {
|
||||
url = url.replace(
|
||||
'http://linconson.com',
|
||||
'https://sp-commerce.myshopify.com',
|
||||
)
|
||||
}
|
||||
|
||||
redirect(url)
|
||||
}
|
||||
|
||||
export async function createCartAndSetCookie() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user