handle empty cart, variants, options, errors

This commit is contained in:
Greg Hoskin
2021-04-30 18:35:19 -05:00
parent b83753f0b9
commit ffbcce2a9e
8 changed files with 33 additions and 75 deletions

View File

@@ -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) {