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:
{{ product.title }}
<!-- 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
{% for product in context.products %}
<item>
<name>{{ product.title }}</name>
</item>
{% endfor %}
<item>
<name>Test Product</name>
</item>
context.product_variants
Full list of product variants.
Example
{% for variant in context.product_variants %}
<item>
<name>{{ variant.title }}</name>
<price>{{ variant.price }}</price>
</item>
{% endfor %}
<item>
<name>Super Heroes Attack</name>
<price>115.00</price>
</item>
context.collections
Full list of existing collections in the store product catalog.
Example
{% for collection in context.collections %}
<item>
<name><![CDATA[{{ collection.title }}]]></name>
</item>
{% endfor %}
<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
{{ product.id }}
41507219767494
product.sku
Returns product SKU.
Example
{{ product.sku }}
TOY01
product.title
Returns product name.
Example
{{ product.title }}
Fun Family Fair
product.body_html
Returns product description. HTML formatting is supported.
Example
{{ product.body_html }}
Product description string
product.vendor
Returns product vendor name.
Example
{{ product.vendor }}
Funtoy
product.product_type
Returns product type.
Example
{{ product.product_type }}
TOYS
product.collection_title
Returns the first product collection name from the list of all collections the product is assigned to.
Example
{{ product.collection_title }}
TOYS
product.collection_id
Returns the first product collection identifier from the list of all collections the product is assigned to.
Example
{{ product.collection_id }}
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
{{ product.mapping_collection_title }}
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
{{ product.mapping_collection_id }}
5387
product.category_ids
Returns the array of product categories identifiers the product is assigned to.
Example
{% for category_id in product.category_ids %}
<category_id>{{ category_id }}</category_id>
{% endfor %}
<category_id>291320889437</category_id>
<category_id>291320922205</category_id>
product.collection_titles
Returns an array of collection names for store collections to which the product is assigned.
Example
{% for collection_title in product.collection_titles %}
<title>{{ collection_title }}</title>
{% endfor %}
<title>Shoes</title>
<title>Accessories</title>
<title>Apparel</title>
Alternatively, you can get a string from this array
{{ product.collection_titles | join: ', ' }}
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
{% for collection in product.mapping_collection_titles %}
<title>{{ collection }}</title>
{% endfor %}
<title>Shoes</title>
<title>Women</title>
<title>Apparel</title>
Use | join: ', '
to generate a string from this array:
{{ product.mapping_collection_titles | join: ', ' }}
Shoes, Women, Apparel
product.tags
Returns a list of product tags.
Example
{% for item in product.tags %}
<tag>{{ item }}</tag>
{% endfor %}
<tag>Style</tag>
<tag>Women</tag>
<tag>Summer</tag>
Use | join: ', '
to generate a string from this array:
{{ product.mapping_collection_titles | join: ', ' }}
Style, Women, Summer
product.url
Returns product page URL.
Example
{{ product.url }}
https://store.myshopify.com/products/test-product?om=8179
product.image_url
Returns product image URL.
Example
{{ product.image_url }}
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
{% for urls in product.image_urls %}
<img_url>{{ urls }}</img_url>
{% endfor %}
<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
{{ product.price }}
50
product.compare_at_price
Returns the lowest price within all product’s variants field compare at price.
Example
{{ product.compare_at_price }}
10
product.published_scope
Returns names of sales channels in which the product is visible.
Example
{{ product.published_scope }}
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:
{{ product.metafields }}
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:
{{ product.metafields.my_fields.length }}
{“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
{{ product.variants }}
[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
{{ product.variant_id }}
41507219767494
product.variant_title
Returns product’s variant name
Example
{{ product.variant_title }}
VARIANT-TOY3
product.variant_sku
Returns product’s variant SKU
Example
{{ product.variant_sku }}
TOY03
product.variant_url
Returns product’s variant URL
Example
{{ product.variant_url }}
https://store.myshopify.com/products/super-heroes-attack-set?variant=41598888149190&om=8179
product.variant_image_url
Returns product’s variant image URL
Example
{{ product.variant_image_url }}
https://cdn.shopify.com/s/files/1/0549/3103/0214/products/fd22f7965849f923e9f32e5cd1ad9577.jpg?v=1644932720
product.variant_barcode
Returns product’s variant barcode
Example
{{ product.variant_barcode }}
ABC-1234
product.variant_weight_grams
Returns product’s variant weight in grams
Example
{{ product.variant_weight_grams }}
100
product.variant_price
Returns product’s variant price
Example
{{ product.variant_price }}
50
product.variant_compare_at_price
Returns the original variant’s price before an adjustment or a sale.
Example
{{ product.variant_compare_at_price }}
10
product.variant_qty
Returns the product’s variant stock quantity.
Example
{{ product.variant_qty }}
94
product.variant_inventory_management
Returns the name of product’s variant inventory management system.
Example
{{ product.variant_inventory_management }}
shopify
product.variant_inventory_item_id
Returns the product’s variant inventory identifier. It is used in the inventory management system API.
Example
{{ product.variant_inventory_item_id }}
43605311717574
product.variant_inventory_item_tracked
Returns the boolean value for tracking the inventory of the product’s variant.
Example
{{ product.variant_inventory_item_tracked }}
true
product.variant_cost
Returns the product’s variant cost.
Example
{{ product.variant_cost }}
50
product.variant_option1
Returns the first of the product’s variant option values. Updating the option field updates the title field.
Example
{{ product.variant_option1 }}
Black
product.variant_option2
Returns the second of the product’s variant option values. Updating the option field updates the title field.
Example
{{ product.variant_option2 }}
GIFT
product.variant_option3
Returns the third of the product’s variant option values. Updating the option field updates the title field.
Example
{{ product.variant_option2 }}
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:
{{ product.variant_metafields }}
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:
{{ product.variant_metafields.my_fields.length }}
{“value”:1400.0,“unit”:“mm”}
product.variant_created_at
Returns the product’s variant date and time of creation.
Example
{{ product.variant_created_at }}
2022-01-28 14:27:56 +0200 EET
product.variant_updated_at
Returns the product’s variant date and time of update.
Example
{{ product.variant_updated_at }}
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
{{ variant.id }}
41507219767494
variant.url
Returns product’s variant URL.
Example
{{ variant.url }}
https://store.myshopify.com/products/super-heroes-set?variant=41598888149190&om=8179
variant.image_url
Returns product’s variant image URL
Example
{{ variant.image_url }}
https://cdn.shopify.com/s/files/1/0549/3103/0214/products/fd22f7965849f923e9f32e5cd1ad9577.jpg?v=1644932720
variant.sku
Returns product’s variant SKU.
Example
{{ variant.sku }}
TOY03
variant.barcode
Returns product’s variant barcode.
Example
{{ variant.barcode }}
ABC-1234
variant.price
Returns product’s variant price. Use a money liquid filter to get the value in a monetary format.
Example
{{ variant.price }}
50
variant.compare_at_price
Returns the product’s variant compare at price value.
Example
{{ variant.compare_at_price }}
10
variant.qty
Returns the product’s variant stock quantity.
Example
{{ variant.qty }}
94
variant.inventory_management
Returns the name of product’s variant inventory management system.
Example
{{ variant.inventory_management }}
shopify
variant.inventory_item_tracked
Returns boolean value for tracking the inventory of the product’s variant.
Example
{{ variant.inventory_item_tracked }}
true
variant.inventory_item_id
Returns the product’s variant inventory identifier. The value is used in the inventory management system API.
Example
{{ variant.inventory_item_id }}
43605311717574
variant.inventory_locations
Returns the names of product’s variant stock locations and quantities at each location.
Example
{{ variant.inventory_locations }}
map[Germany Warehouse:50 My Custom Location:20 Shop location:30]
To access the product variant’s quantity at a specific location, add the name of the location, encased in quotes and square brackets, after variant.inventory_locations
.
For example, to output the quantity of product’s variant in location named Germany Warehouse use:
{{ variant.inventory_locations["Germany Warehouse"] }}
50
To check if product’s variant is available at a specific location use:
{% if variant.inventory_locations["Germany Warehouse"] and variant.inventory_locations["Germany Warehouse"] > 0 %}
<quantity>{{ variant.inventory_locations["Germany Warehouse"] }}</quantity>
{% endif %}
<quantity>50</quantity>
In case you are using the product context, you can access to the variant’s locations in the product.variants
iterative cycle.
variant.cost
Returns the product’s variant cost.
Example
{{ variant.cost }}
50
variant.in_stock
Returns the boolean value of product’s variant in stock availability.
Example
{{ variant.in_stock }}
true
variant.option1
Returns the first of the product’s variant option values.
Example
{{ variant.option1 }}
Black
variant.option2
Returns the second of the product’s variant option values.
Example
{{ variant.option2 }}
GIFT
variant.option3
Returns the third of the product’s variant option values.
Example
{{ variant.option3 }}
ENGRAVING
variant.size
Returns the product’s variant size.
Example
{{ variant.size }}
43
variant.color
Returns the product’s variant color.
Example
{{ variant.color }}
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
{{ variant.weight_grams }}
100
variant.created_at
Returns the product’s variant date and time of creation.
Example
{{ variant.created_at }}
2022-01-28 14:27:56 +0200 EET
variant.updated_at
Returns the product’s variant date and time of update.
Example
{{ variant.updated_at }}
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
{{ variant.title }}
Black/GIFT/ENGRAVING
variant.body_html
Returns product’s variant description. HTML formatting is supported.
Example
{{ variant.body_html }}
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
{{ variant.vendor }}
TOYFACTORY
variant.product_type
Returns product’s variant type.
Example
{{ variant.product_type }}
TOYS
variant.collection_id
Returns product’s variant collection identifier.
Example
{{ variant.collection_id }}
284736127174
variant.collection_title
Returns the first collection name from the list of collections the product’s variant is assigned to.
Example
{{ variant.collection_title }}
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
{{ variant.mapping_collection_title }}
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
{{ variant.mapping_collection_id }}
2421
variant.collection_titles
Returns a list of store collection names the product’s variant is assigned to.
Example
{% for collection_title in {{ variant.collection_titles }} %}
<title>{{ collection_title }}</title>
{% endfor %}
<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
{% for collection in variant.mapping_collection_titles %}
<title>{{ collection }}</title>
{% endfor %}
<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:
{{ variant.metafields }}
map[my_fields:map[size:{“value”:34,“unit”:“foot”} diameter:{“value”:3,“unit”:“foot”} produkttyp:pipe]]
variant.tags
Returns product’s variant tags.
Example
{% for item in variant.tags %}
<item>{{ item }}</item>
{% endfor %}
<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
{{ variant.parent_id }}
7183934980294
variant.parent_sku
Returns the SKU of the parent item used to create product’s variants
Example
{{ variant.parent_sku }}
SKU-123
variant.parent_url
Returns the URL of the parent item page used to create product’s variants
Example
{{ variant.parent_url }}
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
{{ variant.parent_image_url }}
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
{% for urls in variant.parent_image_urls %}
<img_url>{{ urls }}</img_url>
{% endfor %}
<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
{{ variant.parent_published_scope }}
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:
{{ variant.parent_metafields }}
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:
{{ variant.parent_metafields.my_fields.size }}
{“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
{{ collection.id }}
75875321
collection.title
Returns the product collection name.
Example
{{ collection.title }}
TOYS