mirror of
https://github.com/vercel/commerce.git
synced 2025-05-28 20:26:58 +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() {
|
export async function redirectToCheckout() {
|
||||||
let cart = await getCart()
|
const cart = await validateAndGetCart()
|
||||||
redirect(cart!.checkoutUrl)
|
|
||||||
|
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() {
|
export async function createCartAndSetCookie() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user