The checkout domain and Shopify's storefront
Give the Shopify checkout a sub-domain of your own, and let Smootify's Redirect theme send every page of the Shopify online store to the same page on your Astro site, with discount links and Collabs links still working.
Shopify keeps its own storefront, the Online Store, at example.myshopify.com. Visitors can still reach it from an old link or a search result. If you do not use it, Smootify’s Redirect theme sends them to your site. It is the same theme for every Smootify site: you set it to your Astro site’s address.
1. What the theme does
- It sends every page of the Online Store to the same page on your site, except the cart page.
- Product and collection pages go to your own routes, using the folder names you set in the theme.
- Shopify’s bot check and discount links keep working. A discount link sends the visitor to your site with the code, and Smootify applies it to the cart.
- The query of the link is forwarded to your site, with the
?discountcode kept from the cookie. - It lets the Smootify dashboard read your app embeds, such as the Shopify Inbox chat, straight from the store: see Shopify Inbox.
- Creator links from Shopify Collabs reach your site through it: see Shopify Collabs.
2. Set it up
- Download the Redirect theme.
- In Shopify, go to Online Store, Themes and upload the file.
- Click Customize, then open Theme settings, Storefront and fill in:
- Hostname: the domain of your site, without the protocol, such as
www.example.com. Use the same host your site answers on: with or withoutwwwas in Deploy to Cloudflare. - Products Base: the folder of your product pages,
productsin the project Studio makes. - Collections Base: the folder of your collection pages,
collectionsin the project Studio makes. - Custom redirects: one line for each other page, as
Shopify path > Storefront path. - Integrate with customer accounts: on by default.
- Hostname: the domain of your site, without the protocol, such as
- Publish the theme.
If you changed the folder names in routes of smootify.config.mjs, use the same names here.
The theme does not add a trailing slash to the address it sends visitors to. On Cloudflare that costs one extra hop to the address with the slash.
Already using an older version? Upload the new file the same way and publish it. A theme uploaded from a file starts with the default settings, so fill in Theme settings, Storefront again.
3. Give the checkout a sub-domain
Your Astro site and the checkout live on two hosts: Cloudflare serves your pages on your main domain, and Shopify serves the checkout. The checkout works on the .myshopify.com address too, but customers trust a checkout on your own domain more, so connect a sub-domain to Shopify:
- Keep your main domain, such as
www.example.com, on the site’s Worker in Cloudflare only: see Deploy to Cloudflare. If it was connected to Shopify before, for an Online Store, remove it from Shopify, or the checkout breaks. - In Shopify, go to Settings → Domains and connect a sub-domain, such as
store.example.com. - Make it the store’s primary domain. The checkout opens on the primary domain.
The checkout is Shopify’s page, not one of your Astro pages: its logo, colours and a few other settings are in Shopify’s checkout settings.
Before you publish
Check these first
- Visitors of the Shopify store land on a 404 page. Products Base or Collections Base differs from the folders of your site.
- Visitors are redirected twice. Hostname is not the host your site answers on, for example without
wwwwhen the site uses it. - The cart page does not redirect. It stays on Shopify’s storefront by design.
- The checkout does not open, or opens on your site’s host. The main domain is still connected to Shopify. Remove it from Shopify and keep it on the Worker only.