Redirect to Shopify Checkout Page from Buy Button Cart Overlay

jegra
New Member
1 0 0

Is there a way to configure the buy button cart component to redirect to the full online checkout page when the 'Checkout' button is clicked (rather than opening the popup window)?

Reply 1 (1)
iBeFound
New Member
9 0 0

Yes... you need to add the following code to the header/footer scripts section of your website.

<script data-shopify-buy-ui="">
window.open = function (open) {
return function (url, name, features) {
// Pass through non-shopify URLS
if (url.indexOf("myshopify") < 0) {
return open.call(window, url, name, features);
}
// Use current window
console.log("Redirecting to:", url);
window.location.href = url;
return null;
};
}(window.open);
</script>

This will open the full checkout page in the same tab/window.