Skip to content
Log in

Using global Liquid tags

On this page

The following global context variables are available in every Liquid render in StoreConnect — both in web theme templates and in POS action parameter expressions. They return a drop of the appropriate type, or nothing, so you can use them in if statements:

```liquid

{% if current_customer %} Hi {{ current_customer.firstname }}! {% endif %} ```

Global context variables

Variable Description
current_store (also store) The current store
current_cart (also cart) The active cart, if any
current_customer (also customer) The logged-in customer contact, if any
current_account (also account) The logged-in customer’s account, if any
current_membership (also membership) The customer’s active membership, if any
current_pricebook The pricebook active for the current context
current_order The current order (available in order confirmation and receipt contexts)
current_request The HTTP request (URL, params, headers)
session_variables Key-value pairs stored in the customer session
store_variables Key-value store configuration variables
theme_variables Key-value theme configuration variables
login The current login session
navigation The store navigation menus
current_page The current page record, when on a page template
current_product The current product, when on a product template
current_product_category The current product category, when on a category template
current_article_category The current article category, when on an article category template
current_outlet The current outlet — available in POS Liquid templates and sync scope filters
current_register The current register — available in POS Liquid templates and sync scope filters

:::note The current_ prefix forms are preferred and are always available. The shorter aliases (store, cart, customer, account, membership) are available for backward compatibility in web theme templates.

current_outlet and current_register are available only in POS contexts. They are not populated in web theme templates. :::

Dynamic URLs

If you have multiple stores that each make use of the same code, you can use liquid for your domain name in URL links. This will create the URL link dynamically, based on the domain of the store the code is being used in:

href=“{{ current_store.domain }}“

href=“{{ current_store.domain }}/slug”

Global drop finders

The following finders are available on all StoreConnect pages. Each one is a lookup variable: you index it with a single record’s key (in square brackets) and it returns that record’s drop, or nothing if no record matches — so you can guard the result with a Liquid if statement. For example, to look up a product by its slug:

{% assign product = all_products["my-featured-product"] %} {% if product %} Was {{ product.formatted_original_price }}, now {{ product.formatted_sale_price }} {% endif %}

The key you pass differs per finder — a product is looked up by its slug, pages, articles and product categories by their url path, and content blocks and media by their identifier:

Finder Returns Key field Example
all_products A single product slug all_products["my-featured-product"]
all_product_categories A single product category path all_product_categories["coffee"]
all_pages A single page path all_pages["about-us"]
all_articles A single article path all_articles["opening-day"]
all_content_blocks A single content block identifier all_content_blocks["homepage-hero"]
all_media A single media item identifier all_media["logo"]

Because the finder returns a full drop, you can chain straight through to any of that record’s fields — for example {{ all_pages["about-us"].title }} or {{ all_content_blocks["homepage-hero"].content }} — without first loading the page the record belongs to. This makes the finders handy for pulling a featured product’s price onto the homepage, rendering a shared content block in a template, or building links to a page that isn’t the current one.

:::note The key must match the record’s key field exactly. If a lookup returns nothing, confirm you are using the right key for that finder (slug for products, url path for pages, articles and product categories, identifier for content blocks and media) and that the value matches the live record. :::

Was this article helpful?

Was this article helpful?