The request object

The request object returns information about the domain used to access your store and the page being accessed.

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!
{% end %}

request.path

Returns the path to the current page.

Input

{{ request.path }}

Output

/collections/classics/products/chambray-shirt

Want to discuss this page?

Visit the Shopify Community