<p>It looks like I'm trying to use variants the way <a href="https://craftcms.stackexchange.com/questions/15423/craft-commerce-product-options?rq=1">options can be used</a>. I'm going to go with options.</p>

CC BY-SA 4.0
2019-05-10T16:32:19.593Z
2019-05-10T16:32:19.593Z
Mark J. Reeves
<p>I'm working on a product template that can display products of any type.</p>

<p>Various product types have varying numbers of variant fields each with their own options as other products. (All of my variant fields pull in other product types.)</p>

<p>I want to display each variant field's options as a separate dropdown on the product page.</p>

<p>Can I dynamically fetch the product's variant fields and field options in my product template? I would need, for a given product, to be able to get:</p>

<ol>
<li>Its product type's variant fields to loop through</li>
<li>Each field's:

<ol>
<li>Options (and I'd want the option of starting the option list with a "None" option)</li>
<li><strong>Or</strong> product type source(s), so that I could display those in an option list directly.</li>
</ol></li>
</ol>

<templating><plugin-craftcommerce><field><products><variants>
Get and display a product's variant fields in twig
# Get and display a product's variant fields in twig

(Asked by: username_0 on 2019-05-10)

I'm working on a product template that can display products of any type.

Various product types have varying numbers of variant fields each with their own options as other products. (All of my variant fields pull in other product types.)

I want to display each variant field's options as a separate dropdown on the product page.

Can I dynamically fetch the product's variant fields and field options in my product template? I would need, for a given product, to be able to get:

1. Its product type's variant fields to loop through
2. Each field's:
   1. Options (and I'd want the option of starting the option list with a "None" option)
   2. **Or** product type source(s), so that I could display those in an option list directly.

**Tags:** templating, plugin-craftcommerce, field, products, variants


---

## 1 answers

### Answer by username_0 on 2019-05-10. Score: 2

It looks like I'm trying to use variants the way [options can be used](https://craftcms.stackexchange.com/questions/15423/craft-commerce-product-options?rq=1). I'm going to go with options.


---

