Shopify/storefront-api-examples

Open the Checkout flow in current browser window

callumflack opened this issue · 4 comments

In both the React examples, the Shopify Checkout flow opens in a new browser tab.

I don't think this is a very good experience.

Is it possible to retain the Checkout flow in the current browser window?

You can add a second argument to window.open to stay in the current window:

window.open(url, "_self")

Was there any other reason why the Checkout opens in a new window? If not, I will close this issue.

Probably not. A PR with those changes would be welcomed 👍

In consuming libraries, like buy button js, this is an option. You can choose to have the link open in the current window or new window. This repository is just a set of examples. You're free to use the code and make any changes you see as necessary. For the sake of the example, I don't think there's a strong argument for opening in the current window vs opening in a new window, since that's the implementer's choice.

I see your POV.

As a designer/dev looking for better ways to use Shopify, this was a casual inspection of the Storefront API. We're steering well clear of using Slate w/ Liquid, etc. so Storefront is our only option if we're using Shopify. We almost didn't choose Shopify b/c we were confused that the checkout opened in a new window. Our immediate reaction was "why?".

So, sure, use the code to one's needs, etc. But I would say the intention for Shopify here is to sell Storefront as a viable option independent of the Shopify platform build requirements. To do that, I'd leave no hanging questions for makers who are shopping for solutions.