product

The product object has the following attributes:

product.available

Returns true if a product is available for purchase. Returns falseif all of the products variants' inventory_quantity values are zero or less, and their inventory_policy is not set to "Allow users to purchase this item, even if it is no longer in stock."

product.collections

Returns an array of all of the collections a product belongs to.

Input

This product belongs in the following collections:

{% for collection in product.collections %}
    {{ collection.title }}
{% endfor %}

Output

This product belongs in the following collections:

Sale
Shirts
Spring

product.compare_at_price_max

Returns the highest compare at price. Use one of the money filters to return the value in a monetary format.

product.compare_at_price_min

Returns the lowest compare at price. Use one of the money filters to return the value in a monetary format.

product.compare_at_price_varies

Returns true if the compare_at_price_min is different from the compare_at_price_max. Returns false if they are the same.

product.content

Returns the description of the product. Alias for product.description.

product.description

Returns the description of the product.

Returns the relative URL of the product's featured image.

product.first_available_variant

Returns the [variant](/themes/liquid-documentation/objects/variant/) object of the first product variant that is available for purchase. In order for a variant to be available, its variant.inventory_quantity must be greater than zero or variant.inventory_policy must be set to continue. A variant with no inventory_policy is considered available.

product.handle

Returns the handle of a product.

product.id

Returns the id of the product.

product.images

Returns an array of the product's images. Use the product_img_url filter to link to the product image on Shopify's Content Delivery Network.

Input

{% for image in product.images %}
    <img src="{{ image.src | product_img_url: 'medium' }}">
{% endfor %}

Output

<img src="//cdn.shopify.com/s/files/1/0087/0462/products/shirt14_medium.jpeg?v=1309278311" />
<img src="http://cdn.shopify.com/s/files/1/0087/0462/products/nice_shirt_medium.jpeg?v=1331480777">
<img src="http://cdn.shopify.com/s/files/1/0087/0462/products/aloha_shirt_medium.jpeg?v=1331481001">

product.options

Returns an array of the product's options.

Input

{% for option in product.options %}
    {{ option }} 
{% endfor %}

Output

Color Size Material

Use size if you need to determine how many options a product has.

Input

{{ product.options.size }}

Output

3

product.price

Returns the price of the product. Use one of the money filters to return the value in a monetary format.

product.price_max

Returns the highest price of the product. Use one of the money filters to return the value in a monetary format.

product.price_min

Returns the lowest price of the product. Use one of the money filters to return the value in a monetary format.

product.price_varies

Returns true if the product's variants have varying prices. Returns false if all of the product's variants have the same price.

product.selected_variant

Returns the variant object of the currently-selected variant if there is a valid ?variant= parameter in the URL. Returns nil if there is not.

Input

<!-- URL = myshop.myshopify.com/products/shirt?variant=124746062 -->
{{ product.selected_variant.id }}

Output

124746062

product.selected_or_first_available_variant

Returns the variant object of the currently-selected variant if there is a valid ?variant= query parameter in the URL. If there is no selected variant, the first available variant is returned. In order for a variant to be available, its variant.inventory_quantity must be greater than zero or variant.inventory_policy must be set to continue. A variant with no inventory_management is considered available.

product.tags

Returns an array of all of the product's tags. The tags are returned in alphabetical order.

Input

{% for tag in product.tags %}
    {{ tag }}
{% endfor %}

Output

new
leather
sale
special

product.template_suffix

Returns the name of the custom product template assigned to the product, without the product. prefix nor the .liquid suffix. Returns nil if a custom template is not assigned to the product.

Input

<!-- on product.wholesale.liquid -->
{{ product.template_suffix }}

Output

wholesale

product.title

Returns the title of the product.

product.type

Returns the type of the product.

product.url

Returns the relative URL of the product.

Input

{{ product.url }}

Output

/products/awesome-shoes

product.variants

Returns an array the product's variants.

product.vendor

Returns the vendor of the product.

Return to top

Ready to put what you've learned into action?

Build an online store with Shopify. Try it free.

Experience the future of retail now.

Shopify Point of Sale. Try it free.