Difference between revisions of "Liquid Template Variables - product"
From Spiffy Stores Knowledge Base
Line 19: | Line 19: | ||
== <code>product.type</code> == | == <code>product.type</code> == | ||
− | Returns the type of this product, for example, "t-shirt" or "garden gnome" | + | Returns the type of this product, for example, "t-shirt" or "garden gnome". |
== <code>product.vendor</code> == | == <code>product.vendor</code> == | ||
− | Returns the vendor of this product, such as "Spiffy Stores" or "Acme Tools" | + | Returns the vendor of this product, such as "Spiffy Stores" or "Acme Tools". |
== <code>product.price</code> == | == <code>product.price</code> == | ||
Line 34: | Line 34: | ||
== <code>product.price_max</code> == | == <code>product.price_max</code> == | ||
+ | |||
+ | Returns the minimum price for this product. | ||
== <code>product.price_varies</code> == | == <code>product.price_varies</code> == | ||
+ | |||
+ | Returns ''true'' if the ''price_min'' is different from ''price_max''. | ||
== <code>product.compare_at_price_min</code> == | == <code>product.compare_at_price_min</code> == | ||
+ | |||
+ | Returns a "compare at" price, that is, the recommended retail price for the least expensive variant of this product. | ||
== <code>product.compare_at_price_max</code> == | == <code>product.compare_at_price_max</code> == | ||
+ | |||
+ | Returns a "compare at" price, that is, the recommended retail price for the most expensive variant of this product | ||
== <code>product.compare_at_price_varies</code> == | == <code>product.compare_at_price_varies</code> == | ||
+ | |||
+ | Returns ''true'' if the ''compare_at_price_min'' is different from ''compare_at_price_max''. | ||
== <code>product.featured_image</code> == | == <code>product.featured_image</code> == | ||
+ | |||
+ | Returns the relative URL path of the featured image. | ||
== <code>product.images</code> == | == <code>product.images</code> == | ||
+ | |||
+ | Returns a collection of all image filenames for this product. | ||
== <code>product.image_count</code> == | == <code>product.image_count</code> == | ||
+ | |||
+ | Returns the number of images for this product. | ||
== <code>product.description</code> == | == <code>product.description</code> == | ||
Line 54: | Line 70: | ||
== <code>product.variants</code> == | == <code>product.variants</code> == | ||
+ | |||
+ | Returns a collection of all of this product's [[Liquid_Template_Variables_-_variant|variants]]. | ||
== <code>product.available</code> == | == <code>product.available</code> == | ||
+ | |||
+ | Returns ''false'' if all variants' quantities are zero and their policies are set to "stop selling when sold out". | ||
== <code>product.collections</code> == | == <code>product.collections</code> == | ||
+ | |||
+ | Returns a list of collections that this product belongs to. | ||
== <code>product.tags</code> == | == <code>product.tags</code> == | ||
+ | |||
+ | Returns a list of the product's tags (represented by simple strings). | ||
== <code>product.url</code> == | == <code>product.url</code> == | ||
The is the relative URL address of the product. | The is the relative URL address of the product. | ||
+ | |||
+ | <pre><a href="{{ product.url }}"><img src="{{ product.featured_image | product_img_url: 'small' }}" /></a></pre> |
Revision as of 17:30, 12 September 2008
The liquid template variable product has the following attributes:
Contents
- 1 product.id
- 2 product.handle
- 3 product.title
- 4 product.type
- 5 product.vendor
- 6 product.price
- 7 product.price_min
- 8 product.price_max
- 9 product.price_varies
- 10 product.compare_at_price_min
- 11 product.compare_at_price_max
- 12 product.compare_at_price_varies
- 13 product.featured_image
- 14 product.images
- 15 product.image_count
- 16 product.description
- 17 product.variants
- 18 product.available
- 19 product.collections
- 20 product.tags
- 21 product.url
product.id
Returns the unique internal number of the product.
This is normally only for internal usage.
product.handle
This is the product handle. The handle uniquely identifies the product in the URL address.
The handle is usually the product's title in lower case with all blanks replaced by a dash. "Red Hat" would have the handle "red-hat".
product.title
Returns the title of this product.
product.type
Returns the type of this product, for example, "t-shirt" or "garden gnome".
product.vendor
Returns the vendor of this product, such as "Spiffy Stores" or "Acme Tools".
product.price
Returns the price for this product. By default this is the minimum price.
product.price_min
Returns the minimum price for this product.
product.price_max
Returns the minimum price for this product.
product.price_varies
Returns true if the price_min is different from price_max.
product.compare_at_price_min
Returns a "compare at" price, that is, the recommended retail price for the least expensive variant of this product.
product.compare_at_price_max
Returns a "compare at" price, that is, the recommended retail price for the most expensive variant of this product
product.compare_at_price_varies
Returns true if the compare_at_price_min is different from compare_at_price_max.
product.featured_image
Returns the relative URL path of the featured image.
product.images
Returns a collection of all image filenames for this product.
product.image_count
Returns the number of images for this product.
product.description
Returns the description of this product.
product.variants
Returns a collection of all of this product's variants.
product.available
Returns false if all variants' quantities are zero and their policies are set to "stop selling when sold out".
product.collections
Returns a list of collections that this product belongs to.
product.tags
Returns a list of the product's tags (represented by simple strings).
product.url
The is the relative URL address of the product.
<a href="{{ product.url }}"><img src="{{ product.featured_image | product_img_url: 'small' }}" /></a>