mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
handle empty cart, variants, options, errors
This commit is contained in:
@@ -8,6 +8,14 @@ export const checkoutCreate = async (fetch: any) => {
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
if (!cart) {
|
||||
const cart = await fetch({
|
||||
query: 'cart',
|
||||
method: 'setItems',
|
||||
variables: [[]],
|
||||
})
|
||||
}
|
||||
|
||||
const checkoutUrl = cart?.checkout_url
|
||||
|
||||
if (checkoutUrl) {
|
||||
|
Reference in New Issue
Block a user