Global variables

These variables can be used and accessed from any file in your theme:

blogs
<ul>
  {% for article in blogs.myblog.articles  %}
   <li>{{ article.title | link_to: article.url }}</li>
  {% endfor %}
</ul>

The liquid variable "blogs" refers to the blogs in your shop. It is important to note that you cannot iterate over blogs. If you want to complete this action, your best bet is to use a linklist.

cart

The liquid variable "cart" refers to the cart in your shop. To view a complete list of cart attributes click here.

collections
{% for product in collections.frontpage.products %}
  {{ product.title }}
{% endfor %}

The liquid variable "collections" contains a list of all of the collections in a shop.

current_page
{% if current_page != 1 %} Page {{ current_page }}{% endif %}

The "current_page" variable returns the number of the page you are on when browsing through paginated content.

current_tags
<!-- in blog.liquid -->
{% if current_tags %}
  <h1>{{ blog.title | link_to: blog.url }} &raquo; {{ current_tags.first }}</h1>
{% else %}
  <h1>{{ blog.title }}</h1>
{% endif %}

The "current_tags" variable will contain a different list of tags depending on the type of template that is rendered. When the template that is being rendered is a collection template, the current_tags variable will contain all of the tags that are used to filter the product collection. When the template that is being rendered is the blog template, the current_tags variable will contain all of the tags that are used to filter the blog. Tags in the current_tags variable will always display in alphabetical order.

customer
{% if shop.customer_accounts_enabled %}
  {% if customer %}
    <a href="/account">My Account</a> 
    {{ 'Log out' | customer_logout_link }}
  {% else %}
    {{ 'Log in' | customer_login_link }} 
    {% if shop.customer_accounts_optional %}
      {{ 'Create an account' | customer_register_link }}
    {% endif %}
  {% endif %}
{% endif %}

The liquid variable "customer" is only defined when a customer is logged-in to the store.

linklists
<ul>
 {% for link in linklists.categories.links %}
    <li>{{ link.title | link_to: link.url }}</li>
  {% endfor %}
</ul>

The liquid variable "linklists" contains a collection of all of the links in your shop. You can access a linklist by calling its handle on linklists.

pages
<h1>{{ pages.about.title }}</h1>
<p>{{ pages.about.author }} says...</p>
<div>{{ pages.about.content }}</div>

The liquid variable "pages" refers to all of the pages in your shop.

page_description
{% if page_description %}
  <meta name="description" content="{{ page_description }}" /> 
{% endif %}

In Shopify 2, merchants can specify a page_description. That field is automatically populated with the product/collection/article description. If the product/collection/article description does not exist, then page_description will render nothing because {{ shop_description }} will return "false".

page_title
{{ page_title }}

The liquid variable {{ page_title }} returns the title of the current page.

shop

The liquid variable "shop" returns information about your shop. To view a list of shop attributes click here.

template
{% if template contains 'product' %}
  WE ARE ON A PRODUCT PAGE.
{% endif %}

The liquid variable "template" returns the name of the template used to render the current page, with the .liquid extension omitted. As a best practice, it is recommended that you use the template variable as a body class.

settings
{% if settings.use_logo %}
{{ 'logo.png' | asset_url | img_tag: shop.name }}
{% else %}
<span class="no-logo">{{ shop.name }}</span>
{% endif %}
{% if settings.featured_collection and settings.featured_collection != '' and collections[settings.featured_collection].handle == settings.featured_collection and collections[settings.featured_collection].products_count > 0 %}
{% for product in collections[settings.featured_collection].products %}
  {% include 'product-loop' %}
{% endfor %}
{% endif %}

The liquid variable "settings" gives you access to all of the theme settings.

theme
Go to your <a href="/admin/themes/{{ theme.id }}/settings">theme settings</a>.

The liquid variable "theme" represents the currently active theme (in other words, the one which contains the template that's currently being rendered).

themes
We have a beautiful mobile theme, it's called {{ themes.mobile.name | link_to_theme: "mobile" }}

The liquid variable "themes" provides access to the shop's published themes.

Ready to put what you've learned into action?

Build an online store with Shopify Try it Free

Experience the future of retail now

Shopify Point of Sale Try it Free