Parameters
NoneReturns
string | null
Returns null if the cart has not been initialized.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get the Shopify checkout URL
openbridge.cart.checkoutUrl()
string | null
Returns null if the cart has not been initialized.
const url = openbridge.cart.checkoutUrl()
console.log(url)
// https://your-store.myshopify.com/cart/c/abc123...
const url = openbridge.cart.checkoutUrl()
if (url) {
window.open(url, '_blank')
}
function updateCheckoutLink() {
const link = document.querySelector('.checkout-link')
const url = openbridge.cart.checkoutUrl()
if (url) {
link.href = url
link.style.display = 'block'
} else {
link.style.display = 'none'
}
}
openbridge.cart.subscribe(updateCheckoutLink)
document.querySelector('.copy-checkout').addEventListener('click', async () => {
const url = openbridge.cart.checkoutUrl()
if (url) {
await navigator.clipboard.writeText(url)
alert('Checkout link copied!')
}
})
.checkout()
instead.