Liquid objects
Liquid objects contain attributes to output dynamic content on the page. For example, the product
object contains an attribute called title
that can be used to output the title of a product.
Liquid objects are also often referred to as Liquid variables.
To output an object's attribute, wrap the object's name in {{
and }}
, as shown below:
Global objects
Anchor link to section titled "Global objects"The following objects can be used and accessed from any file in your theme, and are defined as global objects or global variables.
all_products
Anchor link to section titled "all_products"The all_products
object contains a list of all the products in your store. You can use all_products
to access products by their handles. More info ›
The articles
object can be used to retrieve an article using its handle
.
The blogs
object returns all the blogs in your store. More info ›
canonical_url
Anchor link to section titled "canonical_url"The canonical_url
object returns the canonical URL for the current page. Google's Search Console Help provides more information on canonical URLs.
The cart
object returns your store's cart. More info ›
collections
Anchor link to section titled "collections"The collections
object returns all the collections in your store. More info ›
current_page
Anchor link to section titled "current_page"The current_page
object returns the number of the page a customer is on when browsing through paginated content. More info ›
current_tags
Anchor link to section titled "current_tags"The current_tags
object will return a different list of tags depending on the template that is being rendered. More info ›
The customer
object returns the customer that is logged in to the store. It will not return anything if a customer isn't logged in. More info ›
The linklists
object returns the set of the menus and links in your store. You can access a menu by calling its handle on the linklists
object. More info ›
The handle
object returns the handle of the page that is being viewed. More info ›
The images
object lets you access any image in your store by its filename. More info ›
The pages
object returns a list of all the pages in your store. More info ›
You can return properties for a specific page using ``:
You can also interate through up to 50 pages at a time with pagination:
page_description
Anchor link to section titled "page_description"The page_description
object returns the description of the product, collection, or page that is being rendered. Descriptions for these items can be set in your Shopify admin. More info ›
The page_title
object returns the title of the current page. More info ›
powered_by_link
Anchor link to section titled "powered_by_link"The powered_by_link
object returns a link element that links to a localized version of shopify.com
, based on the shop locale.
recommendations
Anchor link to section titled "recommendations"The recommendations
object returns product recommendations that are related to a given product, based on data from sales, product descriptions, and relations between products and collections.
To show the section, you must make the request using JavaScript and insert the response's HTML on the page. More info ›
The shop
object contains information about your store. More info ›
The scripts
object returns information about a store's active scripts.
To access information about a script, use the syntax scripts.type
, where type
is the script type. There can be only one active script of a particular type. Currently, the only script type is cart_calculate_line_items
.
To learn more about Shopify Scripts, visit the help content for the Shopify Scripts and the Script Editor.
The settings
object lets you access the settings of a store's published theme. More info ›
The template
object returns the name of the template that is being used to render the current page, not including its .liquid
file extension. As a best practice, it's recommended that you apply the template name as a CSS class on your HTML <body>
tag. More info ›
Content objects
Anchor link to section titled "Content objects"The following objects are used to output the content of template and section files, as well as the scripts and stylesheets loaded by Shopify and Shopify apps.
content_for_header
Anchor link to section titled "content_for_header"The content_for_header
object is required in theme.liquid
. It must be placed inside the HTML <head>
tag. It dynamically loads all scripts required by Shopify into the document head. These scripts are required for features like reCAPTCHA, Shopify apps, and more.
You shouldn't try to modify or parse the content_for_header
object. If content_for_header
changes, then the behavior of your Liquid will change.
content_for_index
Anchor link to section titled "content_for_index"The content_for_index
object contains the content of sections to be rendered on the home page. This object must be included in templates/index.liquid
.
content_for_layout
Anchor link to section titled "content_for_layout"The content_for_layout
object is required in theme.liquid
. It must be placed inside the HTML <body>
tag. It dynamically loads content generated by other templates such as index.liquid
or product.liquid
.
Other objects
Anchor link to section titled "Other objects"Some Liquid objects are only used in specific circumstances.
additional_checkout_buttons
Anchor link to section titled "additional_checkout_buttons"Returns true
if a merchant's store has any payment providers with offsite checkouts, such as PayPal Express Checkout. Use additional_checkout_buttons
to check whether these gateways exist, and content_for_additional_checkout_buttons
to show the additional buttons. More info ›
content_for_additional_checkout_buttons
Anchor link to section titled "content_for_additional_checkout_buttons"Returns checkout buttons for any active payment providers with offsite checkouts. More info ›
additional_checkout_buttons
and content_for_additional_checkout_buttons
are used in many Shopify themes: