<p>You can access the default variant using <code>{{ product.defaultVariant }}</code>.</p>

<p>Because <code>product.variants</code> isn't an ElementCriteriaModel you can't sort it like one. You'd have to retrieve the products variants as an ElementCriteriaModel first like so:</p>

<pre><code>{% set lowestPriceVariant = craft.commerce.variants({
  productId: product.id,
  order: 'variants.price'
}).first() %}

{{ lowestPriceVariant.title }}
</code></pre>

CC BY-SA 3.0
2016-07-28T12:35:11.673Z
2016-07-28T14:33:25.327Z
2016-07-28T14:33:25.327Z
Luke Pearce
<p>I'm trying to display the value/price of the default variant for a product.</p>

<p>This is what I currently have:</p>

<pre><code>{% for variant in product.variants %}
  From {{ variant.price|currency(cart.currency) }}
{% endfor %}
</code></pre>

<p>This displays the price of every variant that a product has. How can I just display the default variant price? Or better still, the product variant with the lowest price.</p>

<plugin-craftcommerce>
Show value of default variant
# Show value of default variant

(Asked by: username_0 on 2016-07-28)

I'm trying to display the value/price of the default variant for a product.
This is what I currently have:
{% for variant in product.variants %}
  From {{ variant.price|currency(cart.currency) }}
{% endfor %}

This displays the price of every variant that a product has. How can I just display the default variant price? Or better still, the product variant with the lowest price.

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_1 on 2016-07-28. Score: 3 | Accepted answer

You can access the default variant using {{ product.defaultVariant }}.
Because product.variants isn't an ElementCriteriaModel you can't sort it like one. You'd have to retrieve the products variants as an ElementCriteriaModel first like so:
{% set lowestPriceVariant = craft.commerce.variants({
  productId: product.id,
  order: 'variants.price'
}).first() %}

{{ lowestPriceVariant.title }}


---

