<p>OK, so this did have a really simple solution. Just use isDefault.</p>

<pre><code>{% if variant.isDefault %}Show the product{% endif %}
</code></pre>

<p>Works like a charm.</p>

CC BY-SA 3.0
2017-04-13T14:48:18.997Z
2017-04-13T14:48:18.997Z
Wonko
<p>Folks:</p>

<p>I figured this would be simple but apparently not (for me, anyway).</p>

<ul>
<li>I have a product with two variants (orange and yellow).</li>
<li>I have a page that lists all the available products.</li>
<li>On that page, both variants appear. I really just need one and users
can select their variant from a drop-down on the checkout page.</li>
</ul>

<p>What I've got:</p>

<pre><code>{# get the products from the categories #}
{% set products = craft.commerce.products.type('shirts,shorts') %}

{# show the product main image and link to the product page #}
&lt;a href="{{ product.url }}"&gt;
    {% if product|length %}
        {% set asset = product.productHeroImage.first() %}
    &lt;img src="{{ asset.url }}"&gt;{% endif %}
&lt;/a&gt;
</code></pre>

<p>I did try <code>{% set products = craft.commerce.products.defaultVariant.type('shirts,shorts') %}</code> but get the same results.</p>

<plugin-craftcommerce>
Listing all available default variants
# Listing all available default variants

(Asked by: username_0 on 2017-03-31)

Folks:
I figured this would be simple but apparently not (for me, anyway).

I have a product with two variants (orange and yellow).
I have a page that lists all the available products.
On that page, both variants appear. I really just need one and users
can select their variant from a drop-down on the checkout page.

What I've got:
{# get the products from the categories #}
{% set products = craft.commerce.products.type('shirts,shorts') %}

{# show the product main image and link to the product page #}

    {% if product|length %}
        {% set asset = product.productHeroImage.first() %}
    {% endif %}


I did try {% set products = craft.commerce.products.defaultVariant.type('shirts,shorts') %} but get the same results.

**Tags:** plugin-craftcommerce

---

## 1 answers

### Answer by username_0 on 2017-04-13. Score: 0 | Accepted answer

OK, so this did have a really simple solution. Just use isDefault.
{% if variant.isDefault %}Show the product{% endif %}

Works like a charm.


---

