Re: Turn off Shopify storefront when using headless

Turn off Shopify storefront when using headless

art-ificial
Visitor
1 0 0

I've set up a headless Shopify store using Nextjs and my own domain at art-ificial.tech. I'm using Shopify storefront api to create a checkout and redirecting my customers to there. My problem is that my existing shopify storefront (that I don't use) is still available at checkout.art-ificial.tech. How do I remove this storefront? Note: this is also an issue because if a customer clicks on the Art-Ificial text in the top left corner on the Shopify checkout, it will take them to checkout.art-ificial.tech (the unused storefront) and not art-ificial.tech (the real store pulling + displaying products using storefront api).

Reply 1 (1)

rahulvagadiya
Shopify Partner
1 0 0
I added a workaround that:

 

1. Hides all content on the Shopify Store

2. Shows a "Please wait..."

3. Redirects to the custom store after 1 second.

 


Add the below snippet to the theme.liquid when editing code in Shopify
```
<!-- START -->
<style type="text/css">
body > * {
display: none !important;
}
 
body:after {
content: "Please wait...";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
text-align: center;
padding: 20px;
z-index: 111;
}
</style>
<script type="text/javascript">
setTimeout(() => {
window.location.href = "https://whatever.com/";
}, 1000);
</script>
<!-- END -->
```