Theme Objects
Theme Objects
Liquid objects contain attributes to output dynamic content on the page. For example, the product object contains an attribute called name that can be used to output the name of a product.
Liquid objects are also often referred to as Liquid variables.
To output an object's attribute on the page, wrap them in {{ and }}, as shown below:
{{ product.name }} <!-- Output: “T-rex T-shirt” -->
| Array | Array object is a wrapper object containing other objects eg collection.products. |
|---|---|
first | Get the first element of an array or blank if array contains no elements. |
last | Get the last element of an array or blank if array contains no elements. |
size | Get a number of elements in an array. |
index | Allows to access certain element of an array eg collection.products[3] or collection.products.3 |
| Product | The product object returns attributes relating to a product that exists in retailers store. |
|---|---|
product.name | Get the name of the product. |
product.handle | Get the slug of the product. |
product.description | Get the description of this product. |
product.variants | Get the set of variants for the product. |
product.master_variant | Get the master variant for a product. |
product.has_variants | Whether the product has variants (i.e. is a variant product (true) vs a simple product (false)). |
product.first_available_variant | Returns the first product variant that is available for purchase or alternatively null if no variants exists for purchase. In order for a variant to be available for purchase its variant.inventory_quantity must be greater than zero or variant.track_inventory must be set to false. |
product.main_image | Get the main image for the product. |
product.url | Get the URL linking to the product. You need this for hyperlinking to this product's detail page from anywhere else in the store. |
product.images | Get URL for all the images associated with a product and its variants e.g. {% for image in product.images %} {{ image.src }} {% endfor %} |
product.price | Get the price currently being sold at. By default this is the minimum price. |
product.price_min | Get the minimum price being sold at for the least expesive variant of this product. |
product.price_max | Get the maximum price being sold at for the most expesive variant of this product. |
product.price_varies | Get whether the price varies. Returns True if the product's variants have varying prices. Returns false if all variants have the same price. |
product.base_price | Get the base price i.e. the general pricebook price of the product. Note: If the product has variants and they have different price then product.base_price will return 0. |
product.base_price_min | Get the minimum base price. |
product.base_price_max | Get the maximum base price. |
product.base_price_varies | Get whether the base price varies. |
product.available | Returns false if all variants' quantities are zero. |
product.brand.name | Returns the brand for the product. |
product.product_type.name | Returns the product type e.g. General. |
product.content | Get the description of this product (used on search page when iterating search results). |
product.type | Always returns product string (used on search page when iterating search results). |
product.tags | Returns the tag object which returns an array of all product tags. Note: Tags are returned in the order they were entered in Lightspeed Retail (X-Series). Input: {% for tag in product.tags %} {{ tag.name }}{% endfor %}Output: summer new special dress |
product.options | Returns all options and option values applicable to this product. Input: {% for name, values in product.options %}{{ name }}: [{{ values | join:", " }}]{% endfor %}Output: Color: White, Black Size: Small, Medium, Large |
| Variant | |
|---|---|
variant.available | Returns false if selected variant is sold out. Note: If variant.track_inventory is set to false then variant.available will return true |
variant.id | Get the ID of the variant. |
variant.name | Returns the concatenation of all the variant's option values joined by / e.g. Small/Yellow. |
variant.price | Get the price variant is currently being sold at. |
variant.base_price | Get the base price i.e. recommended retail price for variant. |
variant.track_inventory | Whether we track inventory for this variant at Lightspeed Retail (X-Series). Returns true if Lightspeed Retail (X-Series) Track Inventory is enabled. |
variant.inventory_quantity | Returns current inventory level for this variant (can also return negative value). If variant.track_inventory is set to false then returns 0. |
variant.options | Returns all options and option values applicable to this product. Input: {% for name, values in product.options %} |
| Tag | |
|---|---|
tag.name | Returns the name of the product tag. |
| Collections | |
|---|---|
collection.products | Get the set of products associated with this collection. |
collection.name | Get the name of the collection. |
collection.handle | Get the unique slug of the collection. |
collection.description | Get the description of the collection. |
collection.products_count | Get the number of products in the collection. |
collection.sort_by | Get what the products in the collection should be sorted by. |
collection.url | Get the URL linking to the collection. You need this for hyperlinking to this collection from anywhere else in the store. |
| Page | The page object returns information about static pages that user has setup. |
|---|---|
page.name | Get the title of the page. |
page.handle | Get the slug of the page (alias to getSlug). |
page.content | Get the content of the page. |
page.type | Returns page (used on search page when iterating search results). |
page.url | Get the URL linking to the page. You need this for hyperlinking to this page from anywhere else in the store. |
| Search | |
|---|---|
search.terms | Returns the search query which was entered in the search box. |
search.performed | Returns true if search was performed and false if search page was loaded with no search query (no search was performed). |
search.results | Get array of search results returned. The items in the array can be products and pages. |
search.results_count | Get number of search results returned. |
search.url | Get the URL linking to the search. You need this for hyperlinking to this search from anywhere else in the store. |
search.sort_by | Get what the search results should be sorted by. |
| Paginate | |
|---|---|
paginate.current_page | Get the current page. |
paginate.current_offset | How many items did we skip over so far e.g. if you are paginating by 2 and are on the 3rd page then this would return 4. |
paginate.items | Get the total amount of items in this collection. |
paginate.next | Exists if there is a next page. |
paginate.next.url | URL of the next page. |
paginate.next.title | Returns the title of the link e.g. next. |
paginate.next.islink | Returns true if the part is a link returns false if it is not. |
paginate.previous | Exists if there is a previous page. |
paginate.previous.url | URL of the previous page. |
paginate.previous.title | Returns the title of the link e.g. previous. |
paginate.previous.islink | Returns true if the part is a link returns false if it is not. |
paginate.page_size | Get the size of each page i.e. the amount of items displayed in each page. |
paginate.pages | Get the amount of pages there are e.g. if showing 20 products per page and 100 products all together then returns 5. |
| Cart | |
|---|---|
cart.item_count | Get the number of items currently in the shopping cart. |
cart.items | Get all the line items in the cart. |
cart.total_price | Get the total price of the cart excluding tax and shipping as they are shown/recalculated at Order Summary. |
cart.errors | Returns an error object when there was a problem. |
cart.note | Lets you capture more information on the cart page. You can do this by submitting the cart form with an HTML textarea like: <textarea name="note">{{ cart.note }}</textarea> |
| Cart Error | The error object returns information relating to any errors that occur in the cart object. |
|---|---|
error.id | Get ID related to error. |
error.title | Get title for the error. |
error.description | Get description for the error. |
| Item | The item object represents a single line in the cart object. There is one line item for each distinct product variant in the cart. The item object can be accessed via the cart.items object. |
|---|---|
item.id | Get the id of the line item. |
item.line_price | Get the combined price of all the items in the line item. This is the equivalent of item.price times item.quantity. |
item.quantity | Get the quantity for a line item. |
item.price | Get the price for the line items variant i.e. returns the unit price. |
item.product | Get all of the data associated with the product object e.g. item.product.description will return the description of the product associated with the line item variant. |
item.variant | Get all of the data associated with the variant object e.g. item.variant.base_price will return the base price i.e. recommended retail price of the line item. |
item.image | Get the image associated with the line item i.e. the product.main_image. |
| Navigation | The navigation object represent the navigation that user sets up e.g. Main Menu or Footer. |
|---|---|
navigation.id | Get the id for the navigation. |
navigation.handle | Get the handle for the navigation. |
navigation.name | Get the name of the navigation. |
navigation.links | Get an array of links in the navigation. |
| Link | The link object represents the information relating to the online store. |
|---|---|
active | Returns true if the link is active. |
title | Get the title of the link. |
type | Get the type of link e.g front page page collection http. |
url | Get the url of the link. |
| Store | The store object represents the general information relating to the online store. |
|---|---|
name | Returns the name of the online store as defined in General Settings page. |
meta_title | Returns the home page title for the online store as defined in General Settings page. |
meta_description | Returns the meta description for the online store as defined in General Settings page. |
meta_keywords | Returns the meta keywords for the online store as defined in General Settings page. |
| Form | The form object is used within the form tag. |
|---|---|
form.posted_successfully | Returns true if form was submitted and successfully passed through validation. |
form.errors | Returns form errors if form was submitted and contains errors. |
form.field | Returns value of a form field if form was submitted eg form.email will return value of email address field entered by user. |
| Form Error | The error object returns information relating to any errors that occur while form processing. |
|---|---|
error.field | Name of a field which did not pass validation. If the error is general and related to the whole form blank is returned. |
error.message | Error message. |
Updated 22 days ago
