What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Help with markets subdomains and connecting to hydrogen

Help with markets subdomains and connecting to hydrogen

jennvelez
Visitor
1 0 0

hey there - we have just moved to hydrogen and we are experiencing issues with our Shopify Markets subdomains redirects. 
The hydrogen store of our Primary Market is working properly but all the other market stores ie, UK, EU, NZ are still redirecting to our Shopify liquid theme. 

Any feedback would be appreciate it!

Thanks!!!

Replies 6 (6)

SBD_
Shopify Staff
1831 273 421

Hey @jennvelez 

 

Can you provide the store details? (DM is fine 🙂 )

Scott | Developer Advocate @ Shopify 

ErSanjay
Shopify Partner
325 20 48

@SBD_  Thank you for looking at Hydrogen related query. can you please help me with my query I want to create Hydrogen create a build that was run in GCP or AWS cloud platform.

 

Business Owner & Shopify Plus, Shopify app , Shopify Consultant - Full Stack Sofware Engineer
Warm regards,
Er Sanjay

If you find yourself in need of assistance with your store, don't hesitate to reach out! Feel free to send me a direct message, and I'll do my best to help you out.
oliver-franke
Visitor
2 0 0

Hey Scott,

is there any solution to that you can share? I am having a similar problem. What I want to do is:
myshop.com --> liquid production primary domain

fr.myshop.com --> liquid market subdomain

nl.myshop.com --> hydrogen market subdomain

 

Why do I want to do this?

Because we want to slowly migrate from liquid to hydrogen. The new hydrogen shop comes with a new design and we don't want to risk revenue. That's why we want to migrate from liquid to hydrogen market by market until we have enough feedback to be sure migrating our main market will not have a negative effect on revenue.

 

The issue is: the nl.myshop.com subdomain is still pointing to Liquid even though the target in "Settings > Domains" is set to the Hydrogen production deployment

 

SBD_
Shopify Staff
1831 273 421

Hey @oliver-franke 

 

Can you DM me store details so I can take a peek at your setup please?

Scott | Developer Advocate @ Shopify 

oliver-franke
Visitor
2 0 0

@jennvelez @SBD_ 
So a possible solution is to work with alias domains:

  1. Go to Shopify Markets > Select Market > Domains and languages
  2. Set Market domain to "Primary Domain Only"
  3. Go to Settings > Domains > Select your subdomain
  4. Change "Target" to your Hydrogen deployment
  5. Change "Domain Type" to "Alias domain"

At this point accessing your market specific subdomain should show your Hydrogen storefront. To get correct market/language setting and fetch the market specific data in your shop you can do the following:

 

In your Hydrogen code you'll derive market and language from your domain, see the link here: https://shopify.dev/docs/custom-storefronts/hydrogen/markets/multiple-languages-domains#step-1-creat...

export function getLocaleFromRequest(request: Request): Locale {
  // Get the user request URL
  const url = new URL(request.url);

  // Match the URL host
  switch (url.host) {
    case 'ca.hydrogen.shop':
      return {
        language: 'EN',
        country: 'CA',
      };
      break;
    case 'hydrogen.fr':
      return {
        language: 'FR',
        country: 'CA',
      };
      break;
    default:
      return {
        language: 'EN',
        country: 'US',
      };
  }
}

 

SBD_
Shopify Staff
1831 273 421

Thanks for the digging + follow up! Looks like we're working on making this more seamless. In the mean time will update the docs.

Scott | Developer Advocate @ Shopify