Relative Anchor Links and Selling Separate Languages

nikarc321
New Member
3 0 0

Hi,

I have a couple languages published on my store (English, French) via Selling in multiple languages, and I'm running into a problem with anchor tags not including the full url path when, for example, the url is structured like so: ca.myshop.com/fr (for the French Canadian site).

For example, in liquid, the link to the cart page in the header would look like:

 

<a href="/cart">Cart</a>

 

but on the webpage, the link goes to ca.myshop.com/cart instead of ca.myshop.com/fr/cart.

Is there a way to remedy this so that all the relative links on my site don't break for the French language?

Thanks

0 Likes

Hi @nikarc321 

 

In this case please use Shopify routes for such links: https://shopify.dev/docs/liquid/reference/objects/routes

Input

{{ routes.cart_url }}

Output

/cart