Global expansion, localizing content, and selling in multiple currencies and languages
How can i remove the local language portion from URL path,
{{ request.path }} render all the URL including the "/ar/"page/example,
how can i remove the "/ar/" part from the URL path.
Thanks in Advance
{%- if shop.locale == 'ar' -%}
<div class="button" >
<a href="https://domain.com{{ request.path }}" >
Englsih
</a>
</div>
{%- else -%}
<div class="button" >
<a href="https://domain.com/ar{{ request.path }}" >
arabic
</a>
</div>
{%- endif -%}
Solved! Go to the solution
This is an accepted solution.
Hi @AdamAnas
You can do it like this
{{ request.path | remove: request.locale.root_url }}
If you want to learn more, you can refer to this document.
https://shopify.dev/docs/api/liquid/objects/request
This is an accepted solution.
Hi @AdamAnas
You can do it like this
{{ request.path | remove: request.locale.root_url }}
If you want to learn more, you can refer to this document.
https://shopify.dev/docs/api/liquid/objects/request
When the customer is on the homepage and tries to back to English from Arabic, it's not working. The issue on when the user is on the homepage.
Updated code as follows
{%- if shop.locale == 'ar' -%}
<div class="site-nav__link site-nav__link--icon" >
<a href="{{store.url}}{{ request.path | remove: request.locale.root_url }}" >
Englsih
</a>
</div>
{%- else -%}
<div class="site-nav__link site-nav__link--icon" >
<a href="{{store.url}}/ar{{ request.path | replace: canonical_url, "" }}" >
arabic
</a>
</div>
{%- endif -%}
Hi @AdamAnas
You can certainly concatenate the URL yourself.
<a href="//{{ shop.domain | append: request.path | remove: request.locale.root_url }}" >
Also, please pay attention to some information mentioned in the documentation.
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025