mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Add checkout button
This commit is contained in:
12
lib/bigcommerce/cart/use-open-checkout.tsx
Normal file
12
lib/bigcommerce/cart/use-open-checkout.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import useCart from './use-cart'
|
||||
|
||||
export default function useOpenCheckout() {
|
||||
const { data, mutate } = useCart()
|
||||
|
||||
return async function openCheckout() {
|
||||
window.open(data?.redirect_urls.checkout_url)
|
||||
console.log('URL1', data?.redirect_urls.checkout_url)
|
||||
// Get new redirect urls
|
||||
await mutate()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user