Buy button Same Window

Va_C
Tourist
5 0 1

When we link the buy button to checkout page and after clicking checkout to finalize order the checkout page opens in a new window, is it possible somehow to open it in same window?

This way it would be less noticeable costumers are leaving main website.

Thank you

Replies 12 (12)
JayDBA
Shopify Partner
2 0 1

Unfortunately, it's not working for me, the button is disappearing when I try 

ToucanJack
New Member
1 0 0

Thanks! @DrBee 

 

That worked for me on Chrome, Firefox, and Safari. Do I dare test it on Explorer? Shudder......

 

Shopify should add this to their Buy Button Configuration information pages.

iBeFound
New Member
9 0 0

Expanding on Gary1ie's method, instead of messing with the Buy Button code each time, you can simply place the following code into 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>

 

You only need to do this once and the checkout button will open in the same window from any page on your website where you've used the Buy Button.