@jennvelez @SBD
So a possible solution is to work with alias domains:
- Go to Shopify Markets > Select Market > Domains and languages
- Set Market domain to “Primary Domain Only”
- Go to Settings > Domains > Select your subdomain
- Change “Target” to your Hydrogen deployment
- 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-create-a-utility-that-reads-requested-host
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',
};
}
}