The request object
The request
object returns information about the URL used to access your store and the page being accessed.
request.design_mode
Whether the request is being made from the theme editor.
You can use request.design_mode
to disable undesired behavior in the theme editor.
For example:
{% if request.design_mode %}
<!-- This will only render in the theme editor -->
{% endif %}
request.host
You can use request.host
to check which domain a customer is visiting from.
Input
{{ request.host }}
Output
your-store.myshopify.com
For example, if you have multiple domains, you can show a different greeting based on the request:
{% if request.host == 'myshop.com' %}
Welcome USA!
{% elsif request.host == 'myshop.ca' %}
Welcome Canada!
{% else %}
Welcome!
{% endif %}
request.locale
Returns the shop_locale of the current request.
Input
{{ request.locale.name }}
Output
English
request.path
Returns the path to the current page.
Input
{{ request.path }}
Output
/collections/classics/products/chambray-shirt
request.page_type
Returns the type of the current page. These are the different page types:
404
article
blog
cart
collection
list-collections
customers/account
customers/activate_account
customers/addresses
customers/login
customers/order
customers/register
customers/reset_password
gift_card
index
page
password
product
search