How to get url parameters using shopify liquid?

Member

by brandy , in category: PHP CMS , a month ago

How to get url parameters using shopify liquid?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by adan , a month ago

@brandy 

In Shopify Liquid, you can access URL parameters using the request object. Here's an example of how you can get URL parameters in Shopify Liquid:

1
2
3
{% if request.params.my_param %}
  <p>Value of my_param is: {{ request.params.my_param }}</p>
{% endif %}


In this example, request.params.my_param will retrieve the value of the URL parameter named my_param. You can replace my_param with the name of the URL parameter you want to access.


Keep in mind that not all URL parameters can be accessed using Liquid as some parameters may be protected or not accessible.