QUANTM7 Docs

Request

The request object for current URL, country, locale, and visitor data.

The request object holds information about the current page request. Use it to detect the visitor's country, check the current URL, or read the locale.

Properties

PropertyTypeDescription
request.pathstringThe current URL path (e.g. /products/classic-ring)
request.hoststringThe hostname (e.g. www.mystore.com)
request.countrystringThe visitor's detected country as an ISO code (e.g. GB)
request.localestringThe current locale (e.g. en)
request.user_agentstringThe visitor's browser user agent string

Detecting country

Use request.country to show content based on where the visitor is:

{% if request.country == 'US' %}
  <p>Shipping from our US warehouse. Delivery in 2-3 days.</p>
{% elsif request.country == 'GB' %}
  <p>Free UK delivery on orders over £50.</p>
{% else %}
  <p>We ship worldwide. Delivery times vary by location.</p>
{% endif %}

The country code comes from the visitor's IP address. It follows the ISO 3166-1 alpha-2 standard (two-letter codes like GB, US, DE, FR).

Active page checks

Use request.path to highlight the current page in your navigation:

{% assign main_menu = linklists['main-menu'] %}
{% for link in main_menu.links %}
  <a href="{{ link.url }}"
    {% if request.path == link.url %}class="active"{% endif %}>
    {{ link.title }}
  </a>
{% endfor %}

Locale-aware content

Show different text based on the locale:

{% if request.locale == 'fr' %}
  <p>Bienvenue dans notre boutique</p>
{% else %}
  <p>Welcome to our store</p>
{% endif %}

For most translated text, use the t filter instead. It reads from your theme's locale files and is easier to manage than inline conditionals.

Theme settings

The global theme object gives you access to settings defined in the theme's main configuration file:

PropertyTypeDescription
theme.settingsobjectValues from the theme settings panel
{% if theme.settings.show_announcement_bar %}
  <div class="announcement" style="background: {{ theme.settings.announcement_bg }}">
    {{ theme.settings.announcement_text }}
  </div>
{% endif %}

Theme settings are different from section settings. They apply to the entire theme rather than a single section. Merchants edit them in the visual editor under the "Theme settings" panel.

On this page