Answers.Body: <p>If I understand correctly you can check for available variants, then output whatever detail you need for the items. Something like this should get you started:</p>
  
  <pre><code>{# Check there are variants #}
  {% if product.variants|length %}
  
    {# Loop through the variants #}
    {%- for purchasable in product.variants -%}
  
      {# Check the variant is available #}
      {% if purchasable.stock &lt;= 0 and purchasable.unlimitedStock == false %}
  
        {{ purchasable.description }}
        {{ purchasable.salePrice|commerceCurrency(cart.currency) }}
  
      {% endif %}
    {%- endfor -%}
  
    {% else %}
      {{ "Out of Stock"|t }}
    {% endif %}
  
  {% endif %}
  </code></pre>
  
  <p>If you want to target only a specific variant you can refer to it directly using either its title (slug) or its variant ID, e.g.:</p>
  
  <pre><code>{% set variants = craft.commerce.variants.id(8376).first() %}
  </code></pre>
  
  <p>You can find more detail in <a href="https://craftcommerce.com/docs/variant-model" rel="nofollow noreferrer">the docs for the Variant Model</a> and <a href="https://craftcommerce.com/docs/craft-commerce-variants" rel="nofollow noreferrer">the docs for Craft Commerce Variants</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-24T17:57:56.300Z
Answers.Text: Thank you! This goes into the right direction, it outputs all variants. But is there a way do output one specific variant? Based on the slug or ID for example? I'm thinking of something like this `{% set variantSlug = craft.request.getSegment(4) %}`but I still only get the product (=all variants), not just a specific one.
Answers.UserDisplayName: Max Frischknecht
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-25T08:21:02.047Z
Answers.Text: Sure! I've updated my answer above.
Answers.UserDisplayName: Seth Warburton
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-25T08:30:57.883Z
Answers.Text: Glad to hear it. If my answer helped then perhaps you can mark it as correct. Thanks.
Answers.UserDisplayName: Seth Warburton
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-26T09:02:35.640Z
Answers.Text: Of course! Will do so
Answers.UserDisplayName: Max Frischknecht
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-24T15:39:17.560Z
Answers.LastActivityDate: 2017-07-25T08:20:37.043Z
Answers.LastEditDate: 2017-07-25T08:20:37.043Z
Answers.UserDisplayName: Seth Warburton
Body: <p>I guess this is no big issue, but I'm pretty new to Craft Commerce :)
  I'm trying to code a dynamic template for the product variants page. </p>
  
  <p>This is the scenario: In the shop overview you see every product and all there variants. If you click on a variant image a detail page opens, showing you detailed information about this variant.</p>
  
  <p>How can I access data of the variant (like title, description, asset) dynamically? Based on what the user clicked on?</p>
  
  <p>I've already tried these two answers:</p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/12708/how-do-i-select-a-specific-product-variant-by-element-field-entry">How do I select a specific product variant by element/field/entry?</a></p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/17263/display-image-asset-of-a-variant">Display image asset of a variant</a></p>
  
  <p>The thing is, I can't use lineItem because the variant is not added to the cart yet. And I didn't manage to get the specific variant over getSegment and the url.</p>
  
Tags: <plugin-craftcommerce>
Title: Product Variant Detail Page
ThreadText: # Product Variant Detail Page
  
  (Asked by: username_0 on 2017-07-24)
  
  I guess this is no big issue, but I'm pretty new to Craft Commerce :)
  I'm trying to code a dynamic template for the product variants page.
  
  This is the scenario: In the shop overview you see every product and all there variants. If you click on a variant image a detail page opens, showing you detailed information about this variant.
  
  How can I access data of the variant (like title, description, asset) dynamically? Based on what the user clicked on?
  
  I've already tried these two answers:
  
  [How do I select a specific product variant by element/field/entry?](https://craftcms.stackexchange.com/questions/12708/how-do-i-select-a-specific-product-variant-by-element-field-entry)
  
  [Display image asset of a variant](https://craftcms.stackexchange.com/questions/17263/display-image-asset-of-a-variant)
  
  The thing is, I can't use lineItem because the variant is not added to the cart yet. And I didn't manage to get the specific variant over getSegment and the url.
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-07-24. Score: 1 | Accepted answer
  
  If I understand correctly you can check for available variants, then output whatever detail you need for the items. Something like this should get you started:
  
  ```
  {# Check there are variants #}
  {% if product.variants|length %}
  
    {# Loop through the variants #}
    {%- for purchasable in product.variants -%}
  
      {# Check the variant is available #}
      {% if purchasable.stock <= 0 and purchasable.unlimitedStock == false %}
  
        {{ purchasable.description }}
        {{ purchasable.salePrice|commerceCurrency(cart.currency) }}
  
      {% endif %}
    {%- endfor -%}
  
    {% else %}
      {{ "Out of Stock"|t }}
    {% endif %}
  
  {% endif %}
  
  ```
  
  If you want to target only a specific variant you can refer to it directly using either its title (slug) or its variant ID, e.g.:
  
  ```
  {% set variants = craft.commerce.variants.id(8376).first() %}
  
  ```
  
  You can find more detail in [the docs for the Variant Model](https://craftcommerce.com/docs/variant-model) and [the docs for Craft Commerce Variants](https://craftcommerce.com/docs/craft-commerce-variants).
  
  > **Comments:**
  > **username_0**: Thank you! This goes into the right direction, it outputs all variants. But is there a way do output one specific variant? Based on the slug or ID for example? I'm thinking of something like this `{% set variantSlug = craft.request.getSegment(4) %}`but I still only get the product (=all variants), not just a specific one.  
  > **username_1**: Sure! I've updated my answer above.  
  > **username_1**: Glad to hear it. If my answer helped then perhaps you can mark it as correct. Thanks.  
  > **username_0**: Of course! Will do so  
  
  ---
  
  