How can I obtain the full absolute path URL in liquid?

@Shopify_77 , can fix this one? The method how you can get a url link Is not working when the request is need to be full or absolute. I can’t get for example the close subfolder when this is solo, “/” example: (.com/en/), return: (.com/en) and everything after “?”, it’s just not read. Using request.path or even canonical_url.
My suggestion:

{{ request.get_full_path }}

Make this easy request to get the full and absolute url from https.

Thank you

Yes @Oislt you are right. Shopify need to fix this but I have a solution to get the full absolute path. you have to just copy paste code where you require full path that’s it!

For understand in detail you can find code and steps here - How to Get/Fetch Full URL in Shopify with Query String or Parameters - Sandeep Parihar - Medium

Thanks

@saim007 thanks for your reply. At the moment this is the best solution.

{%- capture contentForQuerystring -%}{{ content_for_header }}{%- endcapture -%}
  {%- assign pageUrl = contentForQuerystring
    | split: '"pageurl":"'
    | last
    | split: '"'
    | first
    | split: '.myshopify.com'
    | last
    | replace: '\/', '/'
    | replace: '%20', ' '
    | replace: '\u0026', '&'
  -%}
  {% capture finalurl %}https://{{ pageUrl }}{% endcapture %}
  {{ finalurl }}

I’m glad to hear that it worked for you. :slightly_smiling_face: Let me know if you need any further assistance.

@saim007 for some reason this is not working well now, for example the follow link: “./collections/mycollection” I got this “./collections/mycollection?_pos=1&_psq=du&_ss=e&_v=1.0”
Any reason to get this?

We have used this code in my website but when you click second time to this link and it’s not working! Please check my code below:

{%- capture contentForQuerystring -%}{{ content_for_header }}{%- endcapture -%}
{%- assign pageUrl = contentForQuerystring
| split: ‘“pageurl”:"’
| last
| split: ‘"’
| first
| split: ‘.myshopify.com’
| last
| replace: ‘/’, ‘/’
| replace: ‘%20’, ’ ’
| replace: ‘\u0026’, ‘&’
-%}
{% capture finalurl %}https://fr.{{ pageUrl }}{% endcapture %}

{% if section.settings.country_name_second != blank %}
{{ section.settings.country_name_second }}
{% endif %}