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’ -%}
{%- else -%}
{%- endif -%}
Kani
April 9, 2023, 2:19am
2
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
1 Like
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’ -%}
{%- else -%}
{%- endif -%}
Kani
April 10, 2023, 7:03am
4
Hi @AdamAnas
You can certainly concatenate the URL yourself.
Also, please pay attention to some information mentioned in the documentation.