I have a shopify store. I am passing new parameters on search page using query string anyone tell me how can i get this new query string on search page
Asked
Active
Viewed 3,215 times
1
-
Ideally when you do a search in a shopify website you get to the search page with the seach parameter in the query. For example if you search "abc" in the website you will be redirected to https://
/search?q=abc. You should be able to get the query parameter – Subhrajyoti Das May 29 '19 at 15:35 -
yes q is default parameters but i want to add more param in query string – Ankit Agrawal May 29 '19 at 16:38
-
Can you share an example? – Subhrajyoti Das May 29 '19 at 16:47
-
https://sitename/search?q=abc&sort_by=price-ascending so in this url i want to get sort_by value – Ankit Agrawal May 29 '19 at 17:03
-
When the search button is clicked write a function which will ignore any events attached to the button and pass the parameter to the search page url. `function(ev){ev.preventDefault; s_url += "new_param=new_value";}` – Subhrajyoti Das May 29 '19 at 17:12
-
i already pass this param to url i want to get this value in liquid file – Ankit Agrawal May 29 '19 at 17:18
-
https://stackoverflow.com/questions/979975/how-to-get-the-value-from-the-get-parameters – Subhrajyoti Das May 29 '19 at 17:22
1 Answers
0
You can't get new parameters outside the default ones using liquid. Liquid is now aware of additional query parameters.
If you really really have to take them in liquid then you will have a hacky option to capture the content_for_header
argument and you can extract the arguments from there ( since there is a URL with the query params there ) with a few splits. You will need to look for the pageurl
string there. But like I said this is a hacky way which should be used as a last resort.

drip
- 12,378
- 2
- 30
- 49