Take your storefront live
When your Hydrogen storefront is ready for launch, move your domain's traffic from the online store to your storefront so that customers land in the right place. Checkout still runs on Shopify, and your online store stays active after launch.
Anchor to What you'll learnWhat you'll learn
In this tutorial, you'll learn how to do the following tasks:
- Serve Shopify checkout from a subdomain.
- Point your primary domain at your Hydrogen storefront.
- Redirect visitors who land on online store pages.
Anchor to How it worksHow it works
Your primary domain, such as example.com, serves your Hydrogen storefront. A subdomain, such as checkout.example.com, serves Shopify checkout. The hydrogen.shop demo uses this pattern.
Anchor to RequirementsRequirements
- Deploy your storefront to production, using Oxygen or another runtime, and run the production checklist against it.
- If you deploy to Oxygen, then make sure that your store's plan includes a public environment. Development stores and trial plans can't make environments public.
Anchor to Step 1: Set up your checkout subdomainStep 1: Set up your checkout subdomain
Connect a subdomain to Shopify and make it your online store's primary domain, so that checkout runs on your own domain.
-
Add the subdomain:
- If you bought your domain from Shopify, then in the Shopify admin, click Settings > Domains, click your domain, and then click Add subdomain. Enter a prefix, such as
checkout, and then click Save. Shopify adds the DNS record for you. - If a third-party provider manages your domain, then add a
CNAMErecord in your provider's DNS settings with the namecheckoutand the valueshops.myshopify.com. Then, in the Shopify admin, click Settings > Domains > Connect existing domain, enter your subdomain, such ascheckout.example.com, and follow the prompts.
- If you bought your domain from Shopify, then in the Shopify admin, click Settings > Domains, click your domain, and then click Add subdomain. Enter a prefix, such as
-
In Settings > Domains, change the subdomain's Target to Online Store.
-
Set the subdomain's domain type to Primary.
DNS changes can take up to 48 hours to take effect. For provider-specific instructions, refer to Connect a subdomain.
Anchor to Step 2: Send storefront traffic to your domain (Oxygen only)Step 2: Send storefront traffic to your domain (Oxygen only)
Point your primary domain at your production Oxygen environment.
If you deploy to another runtime, then skip this step. Instead, point your primary domain at your hosting provider by following its documentation.
If you deploy to another runtime, then skip this step. Instead, point your primary domain at your hosting provider by following its documentation.
-
In your domain provider's DNS settings, point your domain to Shopify:
- Add an
Arecord with the name@and the value23.227.38.65. Remove any otherArecords for@. - Add an
AAAArecord with the name@and the value2620:0127:f00f:5::. Remove any otherAAAArecords for@. - Add a
CNAMErecord with the namewwwand the valueshops.myshopify.com.
- Add an
-
In the Shopify admin, click Settings > Domains > Connect existing domain, enter your domain, and follow the prompts. If your domain is already connected, then skip this step.
-
Make your production environment public:
- In the Shopify admin, click Hydrogen, and then click your storefront.
- Click Storefront settings > Environments and variables.
- Click your production environment.
- Under URL privacy, select Public, and then click Save.
-
In Settings > Domains, change your domain's Target to your production Hydrogen storefront. Do the same for any other domains that should serve your storefront.
-
Set your domain's type to Primary.
For provider-specific DNS instructions, refer to Connect a third-party domain manually.
Anchor to Step 3: Turn off private modeStep 3: Turn off private mode
If your online store is in private mode, then make it public:
- In the Shopify admin, click Online Store.
- Click Private, and then select Public.
- Click Update. If you're launching the store for the first time, then click Launch store instead.
Anchor to Step 4: Redirect online store visitorsStep 4: Redirect online store visitors
After launch, visitors can still browse online store pages at your {shop}.myshopify.com URL. To send them to your Hydrogen storefront, publish the Hydrogen redirect theme:
- Download the Hydrogen redirect theme.
- In the Shopify admin, click Online Store.
- In the Draft themes section, click Import > Upload zip file, and then upload the ZIP file.
- Click Edit theme on the redirect theme.
- In Theme settings > Storefront, enter your Hydrogen storefront's domain in Hostname, without the protocol. For example,
example.com. - Optional: To send online store paths to different storefront paths, add rules to Custom redirects, one rule per line, in the format
/shopify-path > /storefront-path. For example,/account/login > /login. - Publish the theme.
If you advertise through the Meta or Google sales channels, then your product feeds still link to online store URLs. Update them to use your storefront's domain, with a third-party feed tool or rules that rewrite product URLs. Refer to the Meta and Google documentation.