Objects
Liquid objects represent variables that you can use to build your theme. Object types include store resources, standard Shoplazza content, and functional elements that help you to build interactivity.
Objects might represent a single data point or contain multiple properties. Some properties might represent a related object, such as a product in a collection.
Note
Liquid objects are also often referred to as Liquid variables.
Usage
Objects, along with their properties, are wrapped in curly brace delimiters {{ }}
.
For example, the product
object contains a property called title
that can be used to output the title of a product.
{{ product.title }}
{
"product": {
"title": "Ace Cashmere Beanie"
}
}
Ace Cashmere Beanie
Object access
The way that you access an object depends on the object and the context in which you want to access it. An object might be accessed in the following ways:
- Globally: The object can be accessed directly in any Liquid theme file, excluding Liquid asset files.
- Through a parent object: Many objects are returned by another object, or as a property of a parent. For example, you can access the
articles
property of the blog object.
Refer to each object to learn about how it can be accessed.
creating
You can also create your own variables using variable tags. Variables are treated like objects syntactically.
{% assign variable = 'custom variable' %}
{{ variable }}
custom variable
Updated over 1 year ago