Extract parameter values from the current URL using Shopify Liquid code

extract parameter values from the current URL using Shopify Liquid code

Hello @shree , Can you please share more details? It’ll help me to address the issue.

Hi @shree ,

You can visit the following link to learn more about the Liquid objects provided by Shopify: Liquid objects (shopify.dev)

Regarding the URL, you can use the variable {{ request.path }} and utilize Liquid to transform it to generate various parameters.

{%- assign path = request.path | split:'"pageurl":"' | last | split:'"' | first |
   replace:'\/','/' | 
   replace:'%20',' ' | 
   replace:'\u0026','&'
-%}

{% assign queryParams = path | split: "/" %}
// queryParams is array

If you have more specific requests, please comment further to let me know.

Hope it helps!

If it helpful, please mark as a solution. Thanks and have a nice day sir!