Skip to main content

Liquid Objects

Liquid objects provide access to product attributes for making a dynamic output for the feed.

Liquid objects can use Liquid filters to modify and format the dynamic content output.

To call the Liquid object place it inside the brackets {{ variable.attribute }} in an output tag of the feed, as shown below:

INPUT
{{ product.title }}

OUTPUT
<!-- product.title = "Superhero toy" -->
Superhero toy

Context

A context is an object that contains all the information on items in the store catalog. You can access attributes for a product, product variants, and product collections within the context.

The item attribute can be obtained within the context.products, context.product_variants, context.collections iteration cycles:

context.products

Full list of parent products from the store catalog.

Example
INPUT
{% for product in context.products %}
<item>
<name>{{ product.title }}</name>
</item>
{% endfor %}
OUTPUT
<item>
<name>Test Product</name>
</item>

context.product_variants

Full list of product variants.

Example
INPUT
{% for variant in context.product_variants %}
<item>
<name>{{ variant.title }}</name>
<price>{{ variant.price }}</price>
</item>
{% endfor %}
OUTPUT
<item>
<name>Super Heroes Attack</name>
<price>115.00</price>
</item>

context.collections

Full list of existing collections in the store product catalog.

Example
INPUT
{% for collection in context.collections %}
<item>
<name><![CDATA[{{ collection.title }}]]></name>
</item>
{% endfor %}
OUTPUT
<item>
<name><![CDATA[ TOYS ]]></name>
</item>

Product

Returns attributes for products in the product catalog. Product attributes have to be called inside the context.products iterative cycle.

product.id

Returns the product identifier.

Example
INPUT
{{ product.id }}
OUTPUT
41507219767494

product.sku

Returns product SKU.

Example
INPUT
{{ product.sku }}
OUTPUT
TOY01

product.title

Returns product name.

Example
INPUT
{{ product.title }}
OUTPUT
Fun Family Fair

product.body_html

Returns product description. HTML formatting is supported.

Example
INPUT
{{ product.body_html }}
OUTPUT
Product description string

product.vendor

Returns product vendor name.

Example
INPUT
{{ product.vendor }}
OUTPUT
Funtoy

product.product_type

Returns product type.

Example
INPUT
{{ product.product_type }}
OUTPUT
TOYS

product.collection_title

Returns the first product collection name from the list of all collections the product is assigned to.

Example
INPUT
{{ product.collection_title }}
OUTPUT
TOYS

product.collection_id

Returns the first product collection identifier from the list of all collections the product is assigned to.

Example
INPUT
{{ product.collection_id }}
OUTPUT
284736127174

product.mapping_collection_title

Returns the collection's name to which the product is mapped within the shopping engine. A brief explanation of collection mapping.

Example
INPUT
{{ product.mapping_collection_title }}
OUTPUT
Shoes

product.mapping_collection_id

Returns the first identifier of the collection to which the product is mapped within the shopping engine. A brief explanation of collection mapping.

Example
INPUT
{{ product.mapping_collection_id }}
OUTPUT
5387

product.category_ids

Returns the array of product categories identifiers the product is assigned to.

Example
INPUT
{{ product.title }}
OUTPUT
285868556486

product.collection_titles

Returns an array of collection names for store collections to which the product is assigned.

Example
INPUT
{% for collection_title in product.collection_titles %}
<title>{{ collection_title }}</title>
{% endfor %}
OUTPUT
<title>Shoes</title>
<title>Accessories</title>
<title>Apparel</title>

Alternatively, you can get a string from this array

INPUT
{{ product.collection_titles | join: ', ' }}
OUTPUT
Shoes, Accessories, Apparel

product.mapping_collection_titles

Returns the array with names of the collections the product is mapped to within the shopping engine. A brief explanation of collection mapping.

Example
INPUT
{% for collection in product.mapping_collection_titles %}
<title>{{ collection }}</title>
{% endfor %}
OUTPUT
<title>Shoes</title>
<title>Women</title>
<title>Apparel</title>

Use | join: ', ' to generate a string from this array:

INPUT
{{ product.mapping_collection_titles | join: ', ' }}
OUTPUT
Shoes, Women, Apparel

product.tags

Returns a list of product tags.

Example
INPUT
{% for item in product.tags %}
<tag>{{ item }}</tag>
{% endfor %}
OUTPUT
<tag>Style</tag>
<tag>Women</tag>
<tag>Summer</tag>

Use | join: ', ' to generate a string from this array:

INPUT
{{ product.mapping_collection_titles | join: ', ' }}
OUTPUT
Style, Women, Summer

product.url

Returns product page URL.

Example
INPUT
{{ product.url }}
OUTPUT
https://store.myshopify.com/products/test-product?om=8179

product.image_url

Returns product image URL.

Example
INPUT
{{ product.image_url }}
OUTPUT
https://cdn.shopify.com/s/files/1/0549/3103/0214/products/a1bc38d22e49bd96073851fa589dffdb.jpg?v=1644932714

product.image_urls

Returns a list of image URLs when products have several images. Use | join: ', ' to generate a string from this array.

Example
INPUT
{% for urls in product.image_urls %}
<img_url>{{ urls }}</img_url>
{% endfor %}
OUTPUT
<img_url>https://cdn.shopify.com/s/files/1/0549/3103/0214/products/84a7e34f1ec16870f3dec205e78a21ad.jpg?v=1650892525</img_url>
<img_url>https://cdn.shopify.com/s/files/1/0549/3103/0214/products/fd22f7965849f923e9f32e5cd1ad9577.jpg?v=1650892527</img_url>

product.extra_image_urls

Similar to previous attribute. Returns a list of image URLs (except the main image) when products have several images. Use | join: ', ' to generate a string from this array.

product.price

Returns product price.

Example
INPUT
{{ product.price }}
OUTPUT
50

product.compare_at_price

Returns the lowest price within all product’s variants field compare at price.

Example
INPUT
{{ product.compare_at_price }}
OUTPUT
10

product.published_scope

Returns names of sales channels in which the product is visible.

Example
INPUT
{{ product.published_scope }}
OUTPUT
global

product.metafields

Returns product’s metafields. Activate metafields to use them. Create a metafield and fill its data for each product the metafield applies to.

Example

Assume products in the store have a metafield with name metafields. Call this metafield to get its values:

INPUT
{{ product.metafields }}
OUTPUT
map[my_fields:map[length:{“value”:1400.0,“unit”:“mm”} width:{“value”:340.0,“unit”:“mm”} produkttyp:table]]

You can access a specific metafield element by adding to the product.metafields variable the metafield name after the dot. For example, to output the length metafield use:

INPUT
{{ product.metafields.my_fields.length }}
OUTPUT
{“value”:1400.0,“unit”:“mm”}

In case you are using the product variant context, you can access to the variant’s parent product metafields with variant.parent_metafields

product.variants

Returns product’s variants.

Example
INPUT
{{ product.variants }}
OUTPUT
[map[barcode: body_html:LEGO Mobile Command Center collection_id:0 collection_title: collection_titles:[] color: compare_at_price:0 cost:0 created_at:2022-02-15 08:45:20 -0500 -0500 id:41598888313030 image_url:https://cdn.shopify.com/s/files/1/0549/3103/0214/products/fd22f7965849f923e9f32e5cd1ad9577.jpg?v=1644932720 in_stock:true inventory_item_id:0 inventory_item_tracked:true inventory_management:shopify mapping_collection_id: mapping_collection_title: mapping_collection_titles:[] metafields:map[] option1:Default Title option2: option3: parent_id:7200553631942 parent_image_url:https://cdn.shopify.com/s/files/1/0549/3103/0214/products/fd22f7965849f923e9f32e5cd1ad9577.jpg?v=1644932720 parent_image_urls:[] parent_metafields:map[] parent_published_scope:global parent_sku: parent_url: price:75 product_type:TOYS qty:6 size: sku:TOY04 tags:[building-sets egnition-sample-data lego toys] title:LEGO Mobile Command Center updated_at:2022-02-15 08:59:10 -0500 -0500 url:https://store.myshopify.com/products/mobile-command-center?variant=41598888313030&om=8179 vendor:LEGO weight_grams:0]]

product.variant_id

Returns product’s variant identifier

Example
INPUT
{{ product.variant_id }}
OUTPUT
41507219767494

product.variant_title

Returns product’s variant name

Example
INPUT
{{ product.variant_title }}
OUTPUT
VARIANT-TOY3

product.variant_sku

Returns product’s variant SKU

Example
INPUT
{{ product.variant_sku }}
OUTPUT
TOY03

product.variant_url

Returns product’s variant URL

Example
INPUT
{{ product.variant_url }}
OUTPUT
https://store.myshopify.com/products/super-heroes-attack-set?variant=41598888149190&om=8179

product.variant_image_url

Returns product’s variant image URL

Example
INPUT
{{ product.variant_image_url }}
OUTPUT
https://cdn.shopify.com/s/files/1/0549/3103/0214/products/fd22f7965849f923e9f32e5cd1ad9577.jpg?v=1644932720

product.variant_barcode

Returns product’s variant barcode

Example
INPUT
{{ product.variant_barcode }}
OUTPUT
ABC-1234

product.variant_weight_grams

Returns product’s variant weight in grams

Example
INPUT
{{ product.variant_weight_grams }}
OUTPUT
100

product.variant_price

Returns product’s variant price

Example
INPUT
{{ product.variant_price }}
OUTPUT
50

product.variant_compare_at_price

Returns the original variant’s price before an adjustment or a sale.

Example
INPUT
{{ product.variant_compare_at_price }}
OUTPUT
10

product.variant_qty

Returns the product’s variant stock quantity.

Example
INPUT
{{ product.variant_qty }}
OUTPUT
94

product.variant_inventory_management

Returns the name of product’s variant inventory management system.

Example
INPUT
{{ product.variant_inventory_management }}
OUTPUT
shopify

product.variant_inventory_item_id

Returns the product’s variant inventory identifier. It is used in the inventory management system API.

Example
INPUT
{{ product.variant_inventory_item_id }}
OUTPUT
43605311717574

product.variant_inventory_item_tracked

Returns the boolean value for tracking the inventory of the product’s variant.

Example
INPUT
{{ product.variant_inventory_item_tracked }}
OUTPUT
true

product.variant_cost

Returns the product’s variant cost.

Example
INPUT
{{ product.variant_cost }}
OUTPUT
50

product.variant_option1

Returns the first of the product’s variant option values. Updating the option field updates the title field.

Example
INPUT
{{ product.variant_option1 }}
OUTPUT
Black

product.variant_option2

Returns the second of the product’s variant option values. Updating the option field updates the title field.

Example
INPUT
{{ product.variant_option2 }}
OUTPUT
GIFT

product.variant_option3

Returns the third of the product’s variant option values. Updating the option field updates the title field.

Example
INPUT
{{ product.variant_option2 }}
OUTPUT
ENGRAVING

product.variant_metafields

Returns the product’s variant meta fields. Activate metafields to use them. Create a metafield and fill its data for each product the metafield applies to.

Example

Assume products in the store have a metafield with name metafields. Call this metafield to get its values:

INPUT
{{ product.variant_metafields }}
OUTPUT
map[my_fields:map[length:{“value”:1400.0,“unit”:“mm”} width:{“value”:340.0,“unit”:“mm”} produkttyp:table]]

Access a specific metafield element by adding to the product.variant_metafields the metafield name after the dot. For example, to output the length metafield use:

INPUT
{{ product.variant_metafields.my_fields.length }}
OUTPUT
{“value”:1400.0,“unit”:“mm”}

product.variant_created_at

Returns the product’s variant date and time of creation.

Example
INPUT
{{ product.variant_created_at }}
OUTPUT
2022-01-28 14:27:56 +0200 EET

product.variant_updated_at

Returns the product’s variant date and time of update.

Example
INPUT
{{ product.variant_updated_at }}
OUTPUT
2022-01-29 13:12:26 +0200 EET

Variant

Returns attributes for product variants in the product catalog. Product variant attributes have to be called inside the context.product_variants iterative cycle.

variant.id

Returns product variant identifier.

Example
INPUT
{{ variant.id }}
OUTPUT
41507219767494

variant.url

Returns product’s variant URL.

Example
INPUT
{{ variant.url }}
OUTPUT
https://store.myshopify.com/products/super-heroes-set?variant=41598888149190&om=8179

variant.image_url

Returns product’s variant image URL

Example
INPUT
{{ variant.image_url }}
OUTPUT
https://cdn.shopify.com/s/files/1/0549/3103/0214/products/fd22f7965849f923e9f32e5cd1ad9577.jpg?v=1644932720

variant.sku

Returns product’s variant SKU.

Example
INPUT
{{ variant.sku }}
OUTPUT
TOY03

variant.barcode

Returns product’s variant barcode.

Example
INPUT
{{ variant.barcode }}
OUTPUT
ABC-1234

variant.price

Returns product’s variant price. Use a money liquid filter to get the value in a monetary format.

Example
INPUT
{{ variant.price }}
OUTPUT
50

variant.compare_at_price

Returns the product’s variant compare at price value.

Example
INPUT
{{ variant.compare_at_price }}
OUTPUT
10

variant.qty

Returns the product’s variant stock quantity.

Example
INPUT
{{ variant.qty }}
OUTPUT
94

variant.inventory_management

Returns the name of product’s variant inventory management system.

Example
INPUT
{{ variant.inventory_management }}
OUTPUT
shopify

variant.inventory_item_tracked

Returns boolean value for tracking the inventory of the product’s variant.

Example
INPUT
{{ variant.inventory_item_tracked }}
OUTPUT
true

variant.inventory_item_id

Returns the product’s variant inventory identifier. The value is used in the inventory management system API.

Example
INPUT
{{ variant.inventory_item_id }}
OUTPUT
43605311717574

variant.cost

Returns the product’s variant cost.

Example
INPUT
{{ variant.cost }}
OUTPUT
50

variant.in_stock

Returns the boolean value of product’s variant in stock availability.

Example
INPUT
{{ variant.in_stock }}
OUTPUT
true 

variant.option1

Returns the first of the product’s variant option values.

Example
INPUT
{{ variant.option1 }}
OUTPUT
Black

variant.option2

Returns the second of the product’s variant option values.

Example
INPUT
{{ variant.option2 }}
OUTPUT
GIFT

variant.option3

Returns the third of the product’s variant option values.

Example
INPUT
{{ variant.option3 }}
OUTPUT
ENGRAVING

variant.size

Returns the product’s variant size.

Example
INPUT
{{ variant.size }}
OUTPUT
43

variant.color

Returns the product’s variant color.

Example
INPUT
{{ variant.color }}
OUTPUT
Blue

variant.weight_grams

Returns the product’s variant weight in grams. Use weight_with_unit liquid filter to display the value in the weight of the store.

Example
INPUT
{{ variant.weight_grams }}
OUTPUT
100

variant.created_at

Returns the product’s variant date and time of creation.

Example
INPUT
{{ variant.created_at }}
OUTPUT
2022-01-28 14:27:56 +0200 EET

variant.updated_at

Returns the product’s variant date and time of update.

Example
INPUT
{{ variant.updated_at }}
OUTPUT
2022-01-29 13:12:26 +0200 EET

variant.title

Returns the product’s variant name. It is generated as a concatenation of variant.option1, variant.option2, variant.option3 values the variant has.

Example
INPUT
{{ variant.title }}
OUTPUT
Black/GIFT/ENGRAVING

variant.body_html

Returns product’s variant description. HTML formatting is supported.

Example
INPUT
{{ variant.body_html }}
OUTPUT
Team up with Batman to take on Clayface and free Mayor McCaskill from the clay prison in The LEGO Batman Movie: Clayface Splat Attack set

variant.vendor

Returns product’s variant vendor name.

Example
INPUT
{{ variant.vendor }}
OUTPUT
TOYFACTORY

variant.product_type

Returns product’s variant type.

Example
INPUT
{{ variant.product_type }}
OUTPUT
TOYS

variant.collection_id

Returns product’s variant collection identifier.

Example
INPUT
{{ variant.collection_id }}
OUTPUT
284736127174

variant.collection_title

Returns the first collection name from the list of collections the product’s variant is assigned to.

Example
INPUT
{{ variant.collection_title }}

OUTPUT
Heroes toys

variant.mapping_collection_title

Returns the first name of the shopping engine collection the product’s variant is mapped to. A brief explanation of collection mapping.

Example
INPUT
{{ variant.mapping_collection_title }}

OUTPUT
Action toys

variant.mapping_collection_id

Returns the first identifier of the shopping engine collection the product’s variant is mapped. A brief explanation of collection mapping.

Example
INPUT
{{ variant.mapping_collection_id }}
OUTPUT
2421

variant.collection_titles

Returns a list of store collection names the product’s variant is assigned to.

Example
INPUT
{% for collection_title in {{ variant.collection_titles }} %}
<title>{{ collection_title }}</title>
{% endfor %}
OUTPUT
<title>Shoes</title>
<title>Accessories</title>
<title>Apparel</title>

variant.mapping_collection_titles

Returns the names of the collections the product’s variant is mapped to within the shopping engine. A brief explanation of collection mapping.

Example
INPUT
{% for collection in variant.mapping_collection_titles %}
<title>{{ collection }}</title>
{% endfor %}
OUTPUT
<title>Women</title>
<title>Apparel</title>
<title>Accessories</title>

variant.metafields

Returns product’s variant metafields. Activate metafields to use them. Create a metafield and fill its data for each product the metafield applies to.

Example

Assume products in the store have a metafield with name metafields. Call this metafield to get its values:

INPUT
{{ variant.metafields }}
OUTPUT
map[my_fields:map[size:{“value”:34,“unit”:“foot”} diameter:{“value”:3,“unit”:“foot”} produkttyp:pipe]]

variant.tags

Returns product’s variant tags.

Example
INPUT
{% for item in variant.tags %}
<item>{{ item }}</item>
{% endfor %}
OUTPUT
<item>Summer</item>
<item>Beach</item>
<item>Accessories</item>

variant.parent_id

Returns the identifier of the parent item used to create product’s variants

Example
INPUT
{{ variant.parent_id }}
OUTPUT
7183934980294

variant.parent_sku

Returns the SKU of the parent item used to create product’s variants

Example
INPUT
{{ variant.parent_sku }}
OUTPUT
SKU-123

variant.parent_url

Returns the URL of the parent item page used to create product’s variants

Example
INPUT
{{ variant.parent_url }}
OUTPUT
https://store.myshopify.com/products/test-product?om=8179

variant.parent_image_url

Returns the image URL of the parent item used to create product’s variants

Example
INPUT
{{ variant.parent_image_url }}
OUTPUT
https://cdn.shopify.com/s/files/1/0549/3103/0214/products/a1bc38d22e49bd96073851fa589dffdb.jpg?v=1644932714

variant.parent_image_urls

Returns URLs of product’s variant parent item images.

Example
INPUT
{% for urls in variant.parent_image_urls %}
<img_url>{{ urls }}</img_url>
{% endfor %}
OUTPUT
<img_url>https://cdn.shopify.com/s/files/1/0549/3103/0214/products/e9f32e5cec16870f3dec205ae78a21ad.jpg?v=1650892525</img_url>
<img_url>https://cdn.shopify.com/s/files/1/0549/3103/0214/products/84a7e34f1ec16870f3dec205e78a21ad.jpg?v=1650892525</img_url>

variant.parent_extra_image_urls

Returns URLs of product’s variant parent item images (except the main image).

variant.parent_published_scope

Returns names of sales channels in which the product’s variant parent item is visible.

Example
INPUT
{{ variant.parent_published_scope }}
OUTPUT
global

variant.parent_metafields

Returns the meta fields of the parent item for product’s variant. Activate metafields to use them. Create a metafield and fill its data for each product the metafield applies to.

Example

Assume products in the store have a metafield with name metafields. Call this metafield to get its values:

INPUT
{{ variant.parent_metafields }}
OUTPUT
map[my_fields:map[size:{“value”:34,“unit”:“foot”} diameter:{“value”:3,“unit”:“foot”} produkttyp:pipe]]

Access a specific metafield element by adding to the variant.parent_metafields variable the metafield name after the dot. For example, to output the length metafield use:

INPUT
{{ variant.parent_metafields.my_fields.size }}
OUTPUT
{“value”:34,“unit”:“foot”}

Collections

Returns the identifier and title of the store product collections. Collection attributes have to be called inside the context.collections iterative cycle.

collection.id

Returns the product collection identifier.

Example
INPUT
{{ collection.id }}
OUTPUT
75875321

collection.title

Returns the product collection name.

Example
INPUT
{{ collection.title }}
OUTPUT
TOYS