MODULES
...
eCommerce
Products

Liquid Reference for Product and Attribute Layouts

9min
while building product and attribute layouts, a large range of dynamic data is available here is a full reference guide "this" object fields the "this" object can be accessed on product detail/item liquid, list/item liquid and attribute layout files it contains the properties of the current product and contains further relevant objects e g price the entire "this" object can be outputted on the page for reference {{this | json}} the following fields are available field name liquid tag description item name {{this name}} the product's name item slug {{this slug}} the part of the url for this product's detail page which refers directly to this product creation date {{this create date}} the date the product was created in admin last edit date {{this last edit date}} the date this product was last edited in admin release date {{this release date}} the date this product is scheduled for release, or was first released on the site (a product will not appear in the list if it has not been released ) expiry date {{this expiry date}} the date this product will be no longer visible on the site (a product will not appear in the list if it has expired ) enabled {{this enabled}} a "true" or "false" boolean value if "false", the product will not appear in the list category array {{this category array}} an array of ids of categories associated with this product description {{this description}} a description of the product image {{this image}} this is the main image for the product, but more can be added with custom field sets accessing custom field sets custom field set data linked to products is available in product detail/item liquid, list/item liquid and attribute layout files any custom field sets that have been associated with the product will be stored under {{this cfs data}} you can output the above liquid in the item liquid file to see all of custom field sets associated with the product each of these will have the key "cfs 1", "cfs 2" etc for example, a developer has created just one custom field set to store information about the guarantee on the product the field can be accessed via {{this cfs data cfs 1 guarantee}} see more information about custom field sets here the price object the price object contains all the information you need to display the product's price in the format you want it is available in product detail/item liquid, list/item liquid and attribute layout files field name liquid tag description price id {{this price id}} the unique id of this product's price product id {{this price product id}} the unique id of the product this price belongs to currency {{this price currency}} the currency code for the currency used by this product e g "gbp" price charge {{this price price charge}} the price of the product as an integer e g for the price "£200 00" this field will display "20000" display price {{this price price display}} if the optional field display price was filled out when the product was created, this will show that price as an integer, else, it will output null this could be for example the rrp or price before tax currency symbol {{this price currency symbol}} the html entity for the currency symbol e g "£" outputted on the page will display "£" when html is rendered price display formatted {{this price price display formatted}} if the optional field display price was filled out when the product was created, this will show that price as an decimal number, else, it will output null this could be for example the rrp or price before tax price charge formatted {{this price original price charge formatted}} this is the price that will be charged to the user, formatted into dollars and cents price charge before tax formatted {{this price price charge before tax formatted}} this is the price before any tax is applied, formatted into dollars and cents the inventory object the inventory object contains the fields related to the current inventory of this product it is available in product detail/item liquid, list/item liquid and attribute layout files field name liquid tag description inventory id {{this inventory id}} the unique id of the object containing the product's inventory enabled {{this inventory enabled}} a "true" or "false" boolean, defaults to true product id {{this inventory product id}} the unique id of the product this inventory object belongs to quantity {{this inventory quantity}} the number of products in the inventory inventory type {{this inventory inventory type}} the type of inventory currently, only "global" is available display type {{this inventory display type}} this stores the policy on what to do when the inventory reaches zero either the product can not be ordered, or it should be hidden from view the attributes object these are available once attributes have been added against the product in admin and you are inside a detail/item liquid file or an attribute layout file you can access the attributes object via the following liquid output {{ this product attribute options }} inside the attribute layout output options for this layout inside the attribute layout, you can access just the options for that specific attribute {{ product attribute options }} output this attribute's name you can also access the name of the attribute this layout is currently displaying {{this attribute properties name}} looping over attribute options and accessing option fields as explained in the attributes layout doc, we recommend you loop over the object and access the fields via the "option" liquid variable {% for option in product attribute options %} {{option name}} this price currency symbol}}{{option price}}) {% endfor %} assuming the above example liquid forloop has been implemented, you can access the fields in the table below remember the "option" liquid variable can be renamed, so if you have done this, replace "option" with the name you have given the variable the object contains attribute options and each of these contains information on the attribute it is linked with field name liquid tag description attribute option id {{ option id }} the unique id of this attribute option attribute option name {{ option name }} the name of this attribute option attribute option chargable price {{ option price charge }} chargable price for this attribute option attribute option chargable price formatted {{ option price charge formatted }} formatted chargable price for this attribute option attribute option display price {{ option price display }} display price for this attribute option attribute option display price formatted {{ option price display formatted }} formatted display price for this attribute option attribute option image {{ option image}} the image for this attribute option attribute id {{ option product attribute id }} the unique id of this attribute attribute name {{ option product attribute name }} the name of the attribute e g size or colour attribute {{ option product attribute product id }} the unique product id that this attribute is associated with