How to get url query params via liquid code

How to get url query params via liquid code

deepen_lau
Shopify Partner
4 0 2

How to get url query params via liquid code when developing theme

for example, i have a url : https://my-store.myshopify.com/collections/all?foo=bar

 

How to get the foo query param using liquid

 

thanks a lot.

Replies 3 (3)

ZenoPageBuilder
Shopify Partner
1052 203 220

Hello @deepen_lau 

It is not possible to get query params with Liquid code.

You will need to process it on client side with Js script code.

Zeno Page Builder - Build responsive & SEO-optimized Landing pages, Blog posts, Product pages and more...
Learn more at zenobuilder.com
deepen_lau
Shopify Partner
4 0 2

Thank you very much

joshcorbett
Shopify Partner
17 0 5

It'll take some backwards and ugly liquid code, but saying simply "no" is a ridiculous and false statement.