How can you access a URL path in Liquid for correct checkout language?

Topic summary

Accessing the full URL path in Liquid to route checkout to the correct language. Using request.path only returns the query string (e.g., “?_ab=0&_fd=0&_sc=1:3019:176”) and omits the language subdirectory (e.g., “/de/”).

  • Problem: request.path is missing the “/de/” segment needed to determine language.

  • Expected: request.path should show “/de/?_ab=0&_fd=0&_sc=1:3019:176”.

  • Suggested workaround: Use JavaScript’s location.href to read the current URL and redirect to the appropriate language-specific URL.

  • Status: No Liquid-only solution was provided; whether Liquid can access the full path including subdirectories remains unanswered.

  • Next steps: Implement client-side detection/redirect with JavaScript, or identify a Liquid variable/filter that exposes the complete path if a server-side approach is required.

Summarized with AI on February 4. AI used: gpt-5.

Hi, for the purpose of routing to the correct checkout language I would need to access the URL path. How can I do this. I already tried request.path but it doesn’t display the whole path. I am getting this:

?_ab=0&_fd=0&_sc=1:3019:176)

but it should be displaying /de/?_ab=0&_fd=0&_sc=1:3019:176)

so right now the subdirectory /de/ is missing when using request.path

Hi @bingobongo ,
You can use javascript (location.href) to do that.
You can get fetch the current URL and then redirect the webpage to some URL using location.href.
Please let me know if you need more help
Thanks & Regards
KaalTechGeeks