Money attributes such as prices and totals are returned in the customer's local (presentment) currency. Use a money filter to show the result as a money amount.
The product object has the following attributes:
product.available
Returns true if a product is available for purchase. Returns false if the inventory_quantity of all product variants is zero or less and their inventory_policy does not allow customers to buy the item when it is out of stock.
product.collections
Returns an array of all collections a product belongs to, except collections that are not available on the sales channel in use.
This product belongs to the following collections:
{% for collection in product.collections %}
{{ collection.title }}
{% endfor %}
This product belongs to the following collections:
Sale
Shirts
Spring
product.compareatprice
Returns the lowest compare-at price of all product variants entered in the shop admin. Same as product.compare_at_price_min.
If none of the product variants has a compare-at price, product.compare_at_price returns nil.
product.compareatprice_max
Returns the highest compare-at price of all product variants entered in the shop admin.
If none of the product variants has a compare-at price, product.compare_at_price_max returns 0.
product.compareatprice_min
Returns the lowest compare-at price of all product variants entered in the shop admin.
If none of the product variants has a compare-at price, product.compare_at_price_min returns 0.
product.compareatprice_varies
Returns true if compare_at_price_min differs from compare_at_price_max, false if they are the same.
product.content
Returns the description of the product. Alias of product.description.
product.created_at
Returns a timestamp of when a product was created in the admin.
{{ product.created_at }}
2019-11-01 05:56:37 -0400
product.description
Returns the description of the product.
product.featured_image
Returns an image object of the product's featured image, which is the first image of the product.
Referencing only product.featured_image returns the relative URL of the image.
Aspect ratio: {{ product.featured_image.aspect_ratio }}
Aspect ratio: 1.0
product.featured_media
Returns the first media attached to the product.
product.firstavailablevariant
Returns the variant object of the first product variant that is available for purchase. A variant is available if its variant.inventory_quantity is greater than zero or variant.inventory_policy is set to continue. A variant without inventory management counts as available.
product.gift_card?
Returns true if the product is a gift card.
product.handle
Returns the handle of a product.
product.hasonlydefault_variant
Returns true if the product only has the default variant. Use it to decide whether to show a variant picker in your product forms.
Products without custom variants have a single default variant whose "Title" option is set to "Default Title".
{% if product.has_only_default_variant %}
<input name="id" value="{{ variant.id }}" type="hidden">
{% else %}
<select name="id">
{% for variant in product.variants %}
<option value="{{ variant.id }}">{{ variant.title }}</option>
{% endfor%}
</select>
{% endif %}
product.id
Returns the ID of the product.
product.images
Returns an array of the product's images. Use the image_url filter to link to the product image on the VersaCommerce content delivery network (CDN).
Use a for loop to return all images of a product:
{% for image in product.images %}
{{ image | image_url: width: 300 }}
{% endfor %}
https://cdn.versacommerce.de/s/files/1/1183/1048/products/boat-shoes.jpeg?v=1459175177&width=300
https://cdn.versacommerce.de/s/files/1/1183/1048/products/boat-shoes-back.jpeg?v=1425177&width=300
https://cdn.versacommerce.de/s/files/1/1183/1048/products/boat-shoes-bottom.jpeg?v=134351&width=300
Alternatively, apply an image_url filter to the product object to return the product's image:
{{ product | image_url: width: 300 }}
https://cdn.versacommerce.de/s/files/1/1183/1048/products/boat-shoes.jpeg?v=1459175177&width=300
Product images can also be returned through product.media.
product.media
Returns an array of the product's media, sorted by the date they were added. Use media filters to create URLs and model viewer tags that render the media on the product page.
For example, use a for loop over every media item of a product:
{% for media in product.media %}
{{ media | media_tag }}
{% endfor %}
product.options
Returns an array of the product's option names.
{% for option in product.options %}
{{ option }}
{% endfor %}
Color Size Material
Use the size filter to find out how many options a product has.
{{ product.options.size }}
3
product.optionsbyname
Gives direct access to a product's options by name. The object keys of options_by_name are case-insensitive.
<label>
Color
<select>
{% for color_option in product.options_by_name['Color'].values %}
<option>{{ color_option }}</option>
{% endfor %}
</select>
</label>
<label>
Color
<select>
<option>Red</option>
<option>Green</option>
</select>
</label>
product.optionswithvalues
Returns an array of the product's options.
{% for product_option in product.options_with_values %}
<label>
{{ product_option.name }}
<select>
{% for value in product_option.values %}
<option {% if product_option.selected_value == value %}selected{% endif %}>{{ value }}</option>
{% endfor %}
</select>
</label>
{% endfor %}
<label>
Color
<select>
<option selected>Red</option>
<option>Green</option>
</select>
</label>
product.price
Returns the lowest price of all variants of the product. Same as product.price_min.
product.price_max
Returns the highest price of all variants of the product.
product.price_min
Returns the lowest price of all variants of the product.
product.price_varies
Returns true if the product's variants have different prices, false if all variants have the same price.
product.published_at
Returns a timestamp of when a product was published in a shop.
{{ product.published_at }}
2019-11-01 05:56:37 -0400
product.requiressellingplan
Returns true if variant.requires_selling_plan is true for all variants of the product. VersaCommerce currently has no selling plans.
product.selected_variant
Returns the variant object of the selected variant. The selected variant is based on the variant URL parameter.
If no variant is selected, this property returns nil.
<!-- URL = https://example-shop.versacommerce.de/products/shirt?variant=124746062 -->
{{ product.selected_variant.id }}
124746062
product.selectedorfirstavailablevariant
Returns the variant object of the selected variant. The selected variant is based on the variant URL parameter.
If no variant is selected, the first available variant is returned. A variant is available if variant.inventory_quantity is greater than zero or variant.inventory_policy is set to continue. A variant without inventory management also counts as available.
product.selectedorfirstavailablesellingplanallocation
Returns a selling_plan_allocation object. If the product has no selling plans, this property returns nil. VersaCommerce currently has no selling plans.
product.selectedsellingplan
Returns the selling_plan object based on the selling_plan URL parameter. VersaCommerce currently has no selling plans.
product.selectedsellingplan_allocation
Returns the selling_plan_allocation object based on URL parameters that identify a selling plan and a variant. VersaCommerce currently has no selling plans.
product.sellingplangroups
An array of selling_plan_group objects that contain the product's variants. VersaCommerce currently has no selling plans.
product.tags
Returns an array of all tags of the product. The tags are returned in alphabetical order.
{% for tag in product.tags %}
{{ tag }}
{% endfor %}
leather
new
sale
special
product.template_suffix
Returns the name of the custom product template assigned to the product, without the product. prefix and the .liquid extension. Returns nil if no custom template is assigned.
<!-- on product.wholesale.liquid -->
{{ product.template_suffix }}
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.
{{ product.url }}
/products/awesome-shoes
product.variants
Returns an array of the product's variants.
product.vendor
Returns the vendor of the product.
More properties
VersaCommerce also provides these properties on the product object:
| Properties | Returns |
|---|---|
subtitle, original_title, timestamp, full_url, url_including_shop, position, category, code, gtin, isbn_code, mpn_code, asin_code, ebay_code, currency |
Catalog identifiers, placement and display metadata |
base_quantity, base_quantity_package, base_quantity_sold, base_perform_calculation, calculates_base, base_price, base_unit, unit_price, unit_price_measurement, price_decimal, price_extra_included, extra_price, purchase_price |
Grundpreis and price breakdown |
metafields, properties, properties_count, single_properties, single_properties_count, multiple_properties, multiple_properties_count, hidden_properties, hidden_properties_count, tags_count, tag_list, content_title_tag, content_meta_description, content_meta_keywords |
Catalog properties, tags and SEO fields |
bulk_discounts_active, bulk_discounts, lowest_bulk_discount_price, single_product_reviews, single_product_review_rating, aggregate_product_reviews, aggregate_product_review_rating, recommendations, recommendations_count, is_recommendation |
Volume pricing, reviews and cross-sell data |
variants_count, is_variant, main, parent, collection, options, option_01, option_02, option_03, option_01_label, option_02_label, option_03_label, custom_option_01, custom_option_02, custom_option_03, matched_variant_by_option_values, variant_from_option_values, selected_option_value_ids |
Variant, hierarchy and option selection data |
width, height, length, considers_stock, minimum_stock, shows_stock_amount, stock, amount_available, visible, shipping_types, shipping_types_count, minimum_shipping_cost, calculates_shipping_cost?, requires_shipping, physical, tax_rate, tax_amount, taxable, reservation_enabled, reservations |
Dimensions, stock, fulfillment and tax data |
images_count, featured_image_url, new?, featured?, new_and_featured?, similar_products, similar_products_price_min, similar_products_price_max, similar_products_price_varies |
Image metadata, merchandising flags and mall product comparisons |