Understand variable scope
Global variables are available to rendered storefront templates. Template variables are available only in their matching context. For example,product is available in a product template, while post is available in a post template.
An unavailable value renders blank.
Guard optional values and arrays before you use them:
default for presentation fallbacks:
Global variables
The following top-level values are shared across rendered storefront templates. Some values can still be blank when the current visitor or company does not provide the underlying data.navbar, footer, and sections are also assembled for the current template.
Use their settings within the corresponding theme structure.
On-demand resource collections are not populated for static content renders.
Test a resource loop in a rendered storefront context.
Company points labels
Usecompany.points_label.singular and company.points_label.plural instead of hard-coding a rewards label.
Product and variant values also expose the same pair where points data appears.
Affiliate hydration
Cached storefront HTML can contain sentinel values that the FairShare client replaces after it resolves attribution. Do not treataffiliate.name as a reliable server-rendered sign-in check.
Use affiliate.logged_in_rep_for_store for the sign-in state.
See affiliate hydration before you branch on affiliate fields or build attributable URLs.
Localization
localization.country is the selected country object.
localization.language is the selected language object.
The available collections include display names, ISO codes, and selection state.
Country entries also include currency details.
Product template
Useproduct for the current product.
Images expose fields such as
id, src, url, position, and media_type.
Variants include identity, availability, selected option values, localized pricing, images, and points labels.
Bundle groups include their selection constraints, pricing configuration, images, and items.
Shop template
Use these values inshop_page templates:
Each
collection.filters entry includes its label, selection values, input name, presentation, and add or remove URLs.
Use the supplied URLs instead of reconstructing filter query strings.
Collection template
Usecollection for the current collection.
Home template
Use these values inhome_page templates:
Prefer the global
products collection for new product loops.
Join template
Use these values injoin_page templates:
Each entry in
collection.enrollment_packs uses the enrollment-pack shape described below.
Medium template
Medium templates expose the medium fields at the top level.
Check
kind before selecting a media-specific URL:
Enrollment-pack template
Useenrollment_pack for the current enrollment pack.
Membership and subscription product entries include display values, product options, and bundle information where applicable.
Agreement entries include
id, title, description, and required.
Library template
Library templates expose:
Every library item includes
id, type, title, description, image, and url.
Product items add product, pricing fields, and enrollment items add enrollment_pack.
Medium items add kind and the matching media URLs.
My Site template
Usefluid_affiliate in mysite templates.
Each display card identifies the saved item and contains a
favoriteable object.
The nested object provides common card content plus resource-specific URLs, pricing, or media fields.
Cart template
Usecart in cart_page templates.
Cart items contain the line’s resource, quantity, pricing, and option data supplied to the storefront cart.
Guard optional product or enrollment-pack details because the item shape depends on its resource.
Post template
Usepost for the current post.
Category and collection summaries include
id, title, description, and image_url.
Use variables from schema settings
Resource settings resolve saved identifiers into Liquid values. For example, aproduct setting makes the selected product available at section.settings.featured_product.
section.settings or block.settings.
See schema components for supported resource setting types.