Product Variables

Variable Usage
product.description Returns the long description for the product.
{{ product.description|unescape }}
product.enabled Returns true if the product is enabled in the backend of your store.
{% if product.enabled %}    The product is enabled.{% endif %}	
product.fullPrice Returns the base price for the product. The currency filter formats the price based on the settings of the currency tab in the eCommerce section of the backend.
<span class="oldprice">{{ product.fullPrice|currency }}</span>
product.id Returns the id of the product
<input type="hidden" name="productId" value="{{ product.id }}"/>
product.images Returns a collection of images associated with the product. A default image can also be set in the event that no image has been uploaded for the product.
{% for image in product.images %}
    <img src="{{ image.thumbnail(400, 'auto', {crop: true}) | default('http://placehold.it/460x300') }}">
 {% endfor %}

The thumbnail method uses width and height to specify the image
dimensions. If both width and height are set to 'auto', the generated
thumbnail will be the size of the original image. 

The following options (array) are also available: 

'type': image type, supported values are gif, jpeg, jpg and png.

'keepRatio': used when both width and height are not 'auto', prevents
the thumbnail from being stretched (generated thumbnail may be smaller
than specified to preserve the aspect ratio). The default value is TRUE.

'crop': allow the generated thumbnail to be cropped to prevent image
stretching, only used if keepRatio is not set and width and height are
both not 'auto'.

'regenerate': force the thumbnail to be regenerated even if a thumbnail
with the specified dimensions already exists.

'background': the background color. The background is created only if
the keepRatio option value is true and the width and height are specified
as integers. The value should be specified in hex format: "#fff" or as
"transparent". The default value is "#fff" for JPEG and GIF images, and
"transparent" for PNG images.

'imageQuality': an integer between 1 and 100. For a lossless format, like
PNG, it is recommended that the image quality be set to 1. 

'thumbnailFileName': a name to give to the filename.
product.images.first.thumbnail() Returns the first image associated with the product.
<img src="{{ product.images.first.thumbnail(746, 'auto')|default('http://placehold.it/460x300') }}">
image.title Returns a product image's alt text or title text.
{% for image in product.images %}
    {{ image.title }}
{% endfor %}
image.description Returns a product image's description.
{% for image in product.images %}
    {{ image.description }}
{% endfor %}
product.in_stock_amount Returns the stock amount for the product. Inventory tracking needs to be enabled to return a value.
{{ product.in_stock_amount }}

product.isOutOfStock() Returns Out of Stock Status. Show "Sold Out" text.
{% if not product.isOutOfStock() or product.allow_preorder %} 
Add to Cart
{% else %}
Sold Out
{% endif %}
product.name Returns the name of the product.
<h2>{{ product.name }}</h2>
product.url_name Returns the URL name of the product. Example shows full path to product.
{{ site_url('/product') }}/{{ product.url_name }}
product.onSale Returns true if On Sale option is checked for the product.
{% if product.onSale %}   The product is on sale.{% endif %}	
product.price Returns the current price for the product. If the product is on sale the sale price will be returned, if not the base price will be returned. The currency filter formats the price based on the settings of the currency tab in the eCommerce section of the backend.
{{ product.price|currency }}
product.priceTiers Returns a collection of data for volume pricing tiers for the product.
{% for priceTier in product.priceTiers %}    
  {{ priceTier.quantity }}    
  {{ priceTier.price }}    
  {{ priceTier.product_id }}
{% endfor %}	
product.short_description Returns the short description for the product.
{% if product.short_description %}     
  {{ product.short_description|unescape }} 
{% endif %}
product.sku Returns the sku for the product.
{{ product.sku }}
product.productType Prints the product's product type name.
{{ product.productType.name }}
product.sort_order Returns the sort order of the product defined in the product page.
{{ product.sort_order }}
product.allow_preorder Returns true if Allow Pre-Order option is checked for the product.
{{ product.allow_preorder }}
Product Attributes
product.productAttributes Returns a collection of attributes associated with the product.
{% for attribute in product.productAttributes %}...{% endfor %}
attribute.name Returns the product attribute name.
{% for attribute in product.productAttributes %}   {{ attribute.name }}{% endfor %}	
attribute.value Returns the product attribute value.
{% for attribute in product.productAttributes %}   {{ attribute.value }}{% endfor %}
Product Options
product.options Returns a collection of options associated with the product.
{% for option in product.options %}...{% endfor %}	
option.id Returns the product option id.
{% for option in product.options %}   {{ option.id }}{% endfor %}
option.name Returns the product option name.
{% for option in product.options %}   {{ option.name }}{% endfor %}
option.values Returns a collection of values associated with the product option.
{% for option in product.options %}   {{ option.values }}{% endfor %}	
Product Variants
product.productVariants Returns a collection of variants associated with the product.
{% for variant in product.productVariants %} ... {% endfor %}	
variant.images Returns a collection of images associated with the variant.
{% for variant in product.productVariants %}  
  {% for image in variant.images %}
    <img src="{{ image.thumbnail(80, 80) }}">
  {% endfor %}
{% endfor %}
variant.images.first.thumbnail() Returns the first image associated with the variant.
{% for variant in product.productVariants %}
  <img src="{{ variant.images.first.thumbnail(80, 80) }}">
{% endfor %}	
variant.base_price Returns the variant price.
{% for variant in product.productVariants %}    
  {{ variant.base_price }}{% endfor %}
variant.sale_price_or_discount Returns the variant sale price or discount amount.
{% for variant in product.productVariants %}    
  {{ variant.sale_price_or_discount }}
{% endfor %}	
variant.sku Returns the variant sku.
{% for variant in product.productVariants %}    
  {{ variant.sku }}
{% endfor %}
variant.height Returns the variant height.
{% for variant in product.productVariants %}    
  {{ variant.height }}
{% endfor %}	
variant.width Returns the variant width.
{% for variant in product.productVariants %}    {{ variant.width }}{% endfor %}
variant.depth Returns the variant depth.
{% for variant in product.productVariants %}    {{ variant.depth }}{% endfor %}	
variant.weight Returns the variant weight.
{% for variant in product.productVariants %}    {{ variant.weight }}{% endfor %}
variant.getVariantOptions Returns the variant options' names and values in an array.
{% for name, value in variant.getVariantOptions %}  
  option_name: {{ name }}  
  option_value: {{ value }}
{% endfor %}
variant.getOptionsArray Returns the variant key and value. Can be used to build the URL for a product variant.
{% for variant in product.productVariants %}    
  {% for key, value in variant.getOptionsArray %}   ...   
  {% endfor %}
{% endfor %}
Product Reviews
product.reviews Returns a collection of approved product ratings
{% for attribute in product.reviews() %}...{% endfor %}
review.title Returns the review title.
{% for review in product.reviews() %}   {{ review.title }}{% endfor %}	
review.comment Returns the review comment.
{% for review in product.reviews() %}    {{ review.comment }}{% endfor %}	
review.from_name Returns the reviewer name.
{% for review in product.reviews() %}    {{ review.from_name }}{% endfor %}
review.from_email Returns the reviewer's email address.
{% for review in product.reviews() %}    {{ review.from_email }}{% endfor %}	
review.item_rating Returns the review's rating (out of 5).
{% for review in product.reviews() %}    {{ review.item_rating }}{% endfor %}	
product.rating Returns summarized product reviews as a average, best, and worst ratings.
{% for attribute in product.rating() %}    ...{% endfor %}
rating.average Returns the review rating as an average of all ratings (with 1 digit of precision).
{{ rating.average }}
rating.total_reviews Returns the total number of approved reviews.
{{ rating.total_reviews }}
rating.best_review Returns the best approved review for the product.
{{ rating.best_review }}
rating.worst_review Returns the worst approved review for the product.
{{ rating.worst_review }}
Product Manufacturer
product.manufacturer.id Returns the product manufacturer's id number.
{{ product.manufacturer.id }}
product.manufacturer.name Returns the product manufacturer's name.
{{ product.manufacturer.name }}
product.manufacturer.description Returns the product manufacturer's description.
{{ product.manufacturer.description }}
product.manufacturer.url_name Returns the product manufacturer's url name for your store. This URL will list all products made by this manufacturer.
{{ product.manufacturer.url_name }}
product.manufacturer.address Returns the product manufacturer's street address.
{{ product.manufacturer.street address }}
product.manufacturer.state.name Returns the product manufacturer's state/province name.
{{ product.manufacturer.state.name }}
product.manufacturer.country.name Returns the product manufacturer's country name.
{{ product.manufacturer.country.name }}
product.manufacturer.postal_code Returns the product manufacturer's postal/zip code.
{{ product.manufacturer.postal_code }}
product.manufacturer.phone Returns the product manufacturer's phone number.
{{ product.manufacturer.phone }}
product.manufacturer.fax Returns the product manufacturer's fax number.
{{ product.manufacturer.fax }}
product.manufacturer.city Returns the product manufacturer's city.
{{ product.manufacturer.city }}
product.manufacturer.email Returns the product manufacturer's email address.
{{ product.manufacturer.email }}
product.manufacturer.website_url Returns the product manufacturer's website URL.
{{ product.manufacturer.website_url }}
Product Categories
product.categories Returns a collection of categories associated with the product. See details on all category variables by clicking the link to the related article on category variables below.
{% for category in product.categories %} ... {% endfor %}	
product.hasCategory("api_code") Returns product categories through the product itself.
{% if product.hasCategory('category') %}
  The product has the desired category
{% endif %}
product.getCustomFieldsArray() Returns array of key/value pairs from configured custom fields.
{{ product.getCustomFieldsArray() }}
product.upsells Returns an array of product upsells.
{% for upsell in product.upsells %}
	<h3>{{ upsell.name }}</h3>
    <a href="#" data-ajax-handler="shop:cart" data-ajax-update="#cart-content=shop-cart-content" data-ajax-extra-fields="upsellId='{{ upsell.id }}'">Add Upsale</a>
{% endfor %}
product.crossSells Returns an array of product cross-sells.
{% for crossSell in product.crossSells %}
	<h3>{{ crossSell.name }}</h3>
    <a href="#" data-ajax-handler="shop:cart" data-ajax-update="#cart-content=shop-cart-content" data-ajax-extra-fields="productId='{{ crossSell.product.id }}'">Add Product</a>
{% endfor %}
product.crossSellsAndUpsells Returns an array of related products, both upsell and cross-sells.
{% for related in product.crossSellsAndUpsells %}
	<h3>{{ related.name }}</h3>
    <a href="#" data-ajax-handler="shop:cart" data-ajax-update="#cart-content=shop-cart-content" data-ajax-extra-fields="productId='{{ related.product.id }}'">Add Product</a>
{% endfor %}
product.extras Returns an array of product extras.
{% for extra in product.extras %}
    <label class="title" for="{{ 'extra-'~index }}">{{ extra.name }} ({{ extra.price|currency }})</label>
    {% if extra.enabled %}
        <input type="checkbox" id="{{ 'extra-'~index }}" {{ checkbox_state(postedExtras[extra.id], extra.id) }} name="extras[{{ extra.id }}]" data-ajax-handler="shop:product" data-ajax-update="#product-page=shop-product">
    {% endif %}
{% endfor %}
product.created_at Returns the product's date of creation.
{{ product.created_at }}
product.is_subscription_only Returns 1 if the product is configured to be only available by subscription.
{% if is_subscription_only %}
Subscription only
{% endif %}
product.subscription_plans Returns any configured subscription plans. See Subscription Plans for details on this object.
{% set first_plan = 1 %}
          {% for plan in product.subscription_plans %}
            <label>
              <input
                type="radio"
                name="product_billing_plan"
                value="{{ plan.id }}"
                {% if first_plan and product.is_subscription_only %}checked{% endif %}/>
                  {{ plan.name }}
            </label>
            {% set first_plan = 0 %}
            {% endfor %}