Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
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!!!
Hey @jennvelez
Can you provide the store details? (DM is fine 🙂 )
Scott | Developer Advocate @ Shopify
@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.
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
Hey @oliver-franke
Can you DM me store details so I can take a peek at your setup please?
Scott | Developer Advocate @ Shopify
@jennvelez @SBD_
So a possible solution is to work with alias domains:
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',
};
}
}
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