Skip to main content
Fluid supplies global variables and template-scoped variables when it renders Liquid. Global variables describe the storefront, request, localization, attribution, and shared resources. Template variables describe the resource or experience being rendered. Use this reference to choose the correct scope before you build a section.

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:
Use default for presentation fallbacks:
Do not use a fallback to hide a misspelled field. Confirm the variable’s context and name first.
A template marked as static content receives a reduced global set. It keeps settings, your own template variables, routes, username, share_guid, and company.id, along with its template variables, navbar, footer, and sections. It loses request, params, localization, country, affiliate, sharing_id, external_id, affiliate_guid, the policy paths, the rest of company, and every on-demand resource collection. Test anything that reads those values in a rendered storefront context.

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

Use company.points_label.singular and company.points_label.plural instead of hard-coding a rewards label. Variants expose the same pair, as do product entries read from a resource collection. A product template’s own product value exposes product.points but not product.points_label, so read the label from company.
Select the singular or plural form yourself. The value does not choose a form based on the number.

Affiliate hydration

Cached storefront HTML can contain sentinel values that the FairShare client replaces after it resolves attribution. Do not treat affiliate.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. Country entries include iso_code, iso, name, selected, unit_system, and a currency object with iso_code, name, symbol, and decimal_places. Language entries include iso_code, iso, name, endonym_name, locale, and selected.
Two values are reserved and always empty: localization.market, and available_languages on an individual country entry. Read localization.available_languages for the storefront’s language list.

Playlist navigation

library_navigation is present only while a playlist item is being viewed. It carries library_index, total_count, title, library_path, previous_url, next_url, active_product_ids, and any_shared_products.
navbar carries base_url, logo_url, cart_url, shop_page_url, seller_name, current_selected_locale, current_country_iso, current_country_name, current_language_name, language_options, and countries. Inside a navbar template, these fields are also available directly. See navbar locale selector for the Liquid markup and JavaScript update flow. footer carries base_url and logo_url.

Product template

Use product for the current product. category and collections are trimmed summaries with id, title, and handle. Images expose id, src, url, position, media_type, alt, width, height, aspect_ratio, and preview_image. media is the same list as images, and featured_media is its first entry. Bundle groups include their selection constraints, pricing configuration, images, and items. product.vendor resolves but is always blank in a product template. Read vendor and type from a product entry in a resource collection instead.
A product template also exposes a sibling recommendations value with products, products_count, and performed.

Variants and per-country pricing

Each entry in product.variants carries: variant_countries is the variant’s per-country price table. It lists every active row for the variant, not only the visitor’s country, so filter it by country_iso when you want one market:
selected_or_first_available_variant is a lighter summary with available, id, sku, price, points, images, and metafields. It carries no variant_countries, so read the price table from product.variants.

Legacy top-level product values

A product template still copies part of the product onto the top level for themes built before product existed. These include title, description, short_description, feature_text, price, unit_price, subscription_price, images, available_values, ratings, reviews, thumbnail_image, limited_stock, selected_variant_id, shop_path, and all_products. Read product.* in new themes. thumbnail_image and limited_stock exist only at the top level and have no product equivalent.

Products read from a resource collection

Product entries in products, collection.products, category.products, and product.recommendations use the same field names as product, plus these extras: handle, content, available, image, image_url, featured_image, compare_at_price, price_min, price_max, price_varies, points_label, first_available_variant, type, selected_variant_id, mutually_exclusive_groups, and is_enrollment. A collection entry also returns the real vendor value rather than the blank one a product template exposes, and its selected_or_first_available_variant adds url, title, and image_url. Its variants carry the same fields, variant_countries included. Four product-template values are not available on a collection entry: price_inclusive_of_tax, price_inclusive_tax_name, metafields_collection, and recommendations.

Shop template

Use these values in shop_page templates: collection.sort_options is a fixed list of price sorts, price_desc and price_asc. Each collection.filters entry carries label, type, operator, param_name, presentation, values, active_values, and inactive_values.
Filter URLs are not composable. A value’s url_to_add is a query string containing only that one filter, so applying it discards every other active filter along with the current sort and page. A value’s url_to_remove is always empty. Build your own query strings from param_name and value whenever your theme supports more than one active filter.
The shop template’s products shadows the global product collection with lighter summaries. Read collection.products when you need full product fields on this page.

Collection template

Use collection for the current collection.

Category template

Use category for the current category. A category value carries no url field. Build category links from the handle:

Home template

Use these values in home_page templates: Prefer the global products collection for new product loops.

Join template

Use these values in join_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. contact carries id, full_name, email, and phone. Each comment carries id, name, initials, created_at, and body. Check kind before selecting a media-specific URL:

Enrollment-pack template

An enrollment-pack template exposes its fields twice: at the top level, and under enrollment_pack. Read enrollment_pack.* so your markup also works when it renders a pack from another template. Both product lists carry title, price, cv, options_with_values, variant_id, product_bundles, product_bundle_groups, bundle_config, and mutually_exclusive_groups. The two lists name their image differently: a membership product uses image_url, and a subscription product uses image and adds learn_more_path. Agreement entries carry id, title, description, and required. Enrollment packs read from the global enrollment_packs collection answer images as well as images_array, and their product entries carry a larger set that adds id, sku, skus, first_variant_id, variant_countries, selected_variant_type_sku, image, and learn_more_path.

Library template

Library templates expose: Every library item includes id, type, title, description, image, and url. Product items add product, display_price, and price. Enrollment-pack items add enrollment_pack and price. Medium items add kind, video_url, pdf_url, image_url, and powerpoint_url.

My Site template

Use fluid_affiliate in mysite templates. Each display card carries id, favoriteable_type, favoriteable_id, and a favoriteable object. The nested object provides id, type, title, description, and image, plus resource-specific fields. Product cards add display_price, price, and url. Enrollment-pack cards add enrollment_pack, price, and url. Medium cards add kind, the matching media URLs, and url. Page, promotion, and playlist cards add url. Personal-site renders are per-affiliate, so affiliate values resolve to real values here rather than hydration sentinels.

Cart template

Use cart 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. Amounts are decimals, and every _in_currency sibling is a formatted string. Use the _for_display fields where a total may not be calculated yet — they render a placeholder instead of a misleading zero.

Post template

Use post for the current post. A post template’s post carries no id. Its category and collection summaries are trimmed to id, title, description, and image_url. Posts read from the posts and most_popular_posts collections carry more: id, status, scheduled_at, the aliases handle, url, image, content, excerpt, author, and published_at, and full category and collection values rather than trimmed summaries.

Page template

Use page in page templates.

Error page template

Use these values in error_page templates:

Member page templates

Templates of type members_dashboard and members_page render on every request for the signed-in member. They receive these values on top of the global variables: The members_login template renders for guests. It receives member_routes.sign_in_url and member_routes.root, and no member value. Storefront templates never receive member. Use the member helpers described in Member-aware sections there, and see Member page templates for the member area.

Index templates

The category_page, collection_page, and post_page templates add no variables of their own. Read the global categories, collections, and posts collections instead.

Tag-scoped variables

Two tags introduce a variable that exists only inside the tag. {% paginate %} sets paginate with current_page, pages, items, page_size, current_offset, end_offset, previous, next, and parts:
paginate.previous, paginate.next, and each paginate.parts entry carry title, url, and is_link. previous and next are blank at the ends of the range. {% form %} sets form with errors, posted_successfully?, and the submitted field values.

Use variables from schema settings

Resource settings resolve saved identifiers into Liquid values. For example, a product setting makes the selected product available at section.settings.featured_product.
Use the setting ID as the key under section.settings or block.settings. An unresolvable identifier produces an empty value, so guard the setting before you read a field. Each resolving setting type produces a predictable shape: A color value answers red, green, blue, alpha, hue, saturation, lightness, rgb, and rgba, and renders as its original string.
See schema components for supported resource setting types.