Locale-aware URLs for MultiMarket

Solved

Locale-aware URLs for MultiMarket

WarrenWolff
Shopify Partner
14 3 9

I'm working on multi-market features and I'm struggling to have the correct URL.
I'm following this documentation which definitely is what I'm looking for but it does not work.

https://shopify.dev/docs/themes/markets/multiple-currencies-languages#locale-aware-urls

 

<a href="{{ routes.cart_url }}">{{ "templates.cart.go_to_cart" | t }}</a>

It should be a no-brainer but it does not work, I have still base URL.

 

To be more specific:

https://findify-liquid-playground.myshopify.com/en-mx/

The /en-mx/ is NEVER shown.

Accepted Solution (1)

WarrenWolff
Shopify Partner
14 3 9

This is an accepted solution.

For the time being I will rely on Javascript side, so rather than having links on <a href="{{ routes.url }}" I will bind an click event and then do this:

 

 

const getSearchDestination = (query) => {
  const root = window.Shopify.routes.root ? window.Shopify.routes.root : '';
  return `${root}search?q=${query}`;
};

 

View solution in original post

Reply 1 (1)

WarrenWolff
Shopify Partner
14 3 9

This is an accepted solution.

For the time being I will rely on Javascript side, so rather than having links on <a href="{{ routes.url }}" I will bind an click event and then do this:

 

 

const getSearchDestination = (query) => {
  const root = window.Shopify.routes.root ? window.Shopify.routes.root : '';
  return `${root}search?q=${query}`;
};