<p>First you need to figure out which one you are using. </p>

<p><strong>LineItem Options:</strong>
Here is the doc for it. 
<a href="https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes" rel="nofollow noreferrer">https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes</a></p>

<p>One thing worth to mention is that options store in lineItem, which is one set of options for each purchasable/variant. So in your form you should put the options in your for loop of the <code>product.getVariants()</code>.
And have the loop index in front just like the purchasable. e.g. </p>

<pre><code>&lt;select name="options[0][max]"&gt;
        {% for i in 1..max %}
            &lt;option value="{{ i }}"&gt;{{ i }}&lt;/option&gt;
        {% endfor %} 
&lt;/select&gt;
</code></pre>

<p>Same with your "qty" it needs to have loop index in front as well.
See the documentation link for example: 
<a href="https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#adding-multiple-purchasables-to-the-cart" rel="nofollow noreferrer">https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#adding-multiple-purchasables-to-the-cart</a></p>

<p><strong>Order Field:</strong>
Didn't find documentation for it in craft CMS commerce 2 docs.
Order field stores with order object. One order has one value for a unique field handle. 
You can use <code>&lt;input type="your-choice" name="fields[customFieldHandle]"/&gt;</code> in "commerce/cart/update-cart" action.
You can retrieve it by calling <code>order.customFieldHandle</code>.</p>

<p>Before you use one custom field in the twig template you need to go your control panel and create a custom field first. "<a href="http://your-site.com/admin/commerce/settings/ordersettings" rel="nofollow noreferrer">http://your-site.com/admin/commerce/settings/ordersettings</a>". Find the "order fields" (name maybe different due to the version of craft, I don't think P&amp;T have ever changed it since beginning.) tab, and create a field just like you would create a field for entry.</p>

<p><strong>Try this form:</strong></p>

<pre><code>&lt;form method="POST" name="main"&gt;
    &lt;input type="hidden" name="action" value="commerce/cart/update-cart"&gt;
    &lt;input type="hidden" name="paymentCurrency" value="{{ currency }}"&gt;

    {{ redirectInput('cart') }}
    {{ csrfInput() }}

    {% set max = product.max %}

    {%- for purchasable in product.getVariants() -%}
        {% if purchasable.isAvailable %}
            &lt;input type="hidden" name="purchasables[{{loop.index}}][id]" value="{{ purchasable.id }}" /&gt;
            &lt;select name="options[{{loop.index}}][max]"&gt;
             {% for i in 1..max %}
                &lt;option value="{{ i }}"&gt;{{ i }}&lt;/option&gt;
             {% endfor %} 
            &lt;/select&gt;
            &lt;input type="hidden" name="purchasables[{{loop.index}}][qty]" value="1"/&gt;
        {% endif %}
    {%- endfor -%}

    {%- for purchasable in product.getVariants() -%}
        {{ purchasable|currencySalePrice('' ~ currency ~ '') }}
    {%- endfor -%}

    &lt;input type="submit" value="{{ "Add to cart"|t }}" class="button"/&gt;
&lt;/form&gt;

</code></pre>

<p>If you want customer to choose one options and apply for all the purchasables.</p>

<p>Just put a hidden input in the for loop and then use JavaScript function to update options in the loop on change.</p>

CC BY-SA 4.0
2019-07-12T09:52:14.547Z
the qty how it is is intentional, I did try your version of the select and it still hasn't worked. I find that this only works when I add an additional 'update' button, but I really want to avoid doing.
Amy
CC BY-SA 4.0
2019-07-12T10:06:33.023Z
Try the form I just posted.
Parry Huang
CC BY-SA 4.0
2019-07-12T10:22:59.970Z
afraid this didn't work either :/
Amy
CC BY-SA 4.0
2019-07-16T02:31:53.570Z
Can you try to add to cart again? And take a look at the storage/logs/web.log. Search for the unique value of the product/purchasable you just try add to cart. See if you can find any error.
Parry Huang
CC BY-SA 4.0
2019-07-16T09:11:41.150Z
Nothing out of the ordinary in the logs, which made me think it's not doing anything with the custom field.
Amy
CC BY-SA 4.0
2019-07-12T09:26:02.230Z
2019-07-12T10:13:03.917Z
2019-07-12T10:13:03.917Z
Parry Huang
<p>I've created a dropdown field for my users to select from on each of my products, but if the user was to select an option from the dropdown and click 'add to cart' , it doesn't show up in their order once it's all gone through. </p>

<p>What I currently have on my products page is:</p>

<pre><code>&lt;form method="POST" name="main"&gt;
    &lt;input type="hidden" name="action" value="commerce/cart/update-cart"&gt;
    &lt;input type="hidden" name="paymentCurrency" value="{{ currency }}"&gt;

    {{ redirectInput('cart') }}
    &lt;input type="hidden" name="qty" value="1"&gt;
    {{ csrfInput() }}

    {% set max = product.max %} 
    {% set i = 0 %}

    &lt;select name="options[max]"&gt;
        {% for i in 1..max %}
            &lt;option value="{{ i }}"&gt;{{ i }}&lt;/option&gt;
        {% endfor %} 
    &lt;/select&gt;

    {%- for purchasable in product.getVariants() -%}
        {% if purchasable.isAvailable %}
            &lt;input type="hidden" name="purchasables[0][id]" value="{{ purchasable.id }}" /&gt;
            &lt;input type="hidden" name="purchasables[0][qty]" value="1" /&gt;
        {% endif %}
    {%- endfor -%}

    {%- for purchasable in product.getVariants() -%}
        {{ purchasable|currencySalePrice('' ~ currency ~ '') }}
    {%- endfor -%}

    &lt;input type="submit" value="{{ "Add to cart"|t }}" class="button"/&gt;
&lt;/form&gt;
</code></pre>

<p>Any reason why 'add to cart' wouldn't update this info and show it in the customers order?</p>

CC BY-SA 4.0
2019-07-12T02:53:14.707Z
Could you paste your full form?
Luke Holder
CC BY-SA 4.0
2019-07-12T08:52:50.240Z
Updated with form
Amy
<craft3><plugin-craftcommerce2><products>
Commerce 2: Custom product fields not showing up in order
# Commerce 2: Custom product fields not showing up in order

(Asked by: username_0 on 2019-07-11)

I've created a dropdown field for my users to select from on each of my products, but if the user was to select an option from the dropdown and click 'add to cart' , it doesn't show up in their order once it's all gone through. 
What I currently have on my products page is:

    
    

    {{ redirectInput('cart') }}
    
    {{ csrfInput() }}

    {% set max = product.max %} 
    {% set i = 0 %}

    
        {% for i in 1..max %}
            {{ i }}
        {% endfor %} 
    

    {%- for purchasable in product.getVariants() -%}
        {% if purchasable.isAvailable %}
            
            
        {% endif %}
    {%- endfor -%}

    {%- for purchasable in product.getVariants() -%}
        {{ purchasable|currencySalePrice('' ~ currency ~ '') }}
    {%- endfor -%}

    


Any reason why 'add to cart' wouldn't update this info and show it in the customers order?

**Tags:** craft3, plugin-craftcommerce2, products

> **Comments:**
> **username_1**: Could you paste your full form?  
> **username_0**: Updated with form  

---

## 1 answers

### Answer by username_2 on 2019-07-12. Score: 1

First you need to figure out which one you are using. 
LineItem Options:
Here is the doc for it. 
https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes
One thing worth to mention is that options store in lineItem, which is one set of options for each purchasable/variant. So in your form you should put the options in your for loop of the product.getVariants().
And have the loop index in front just like the purchasable. e.g. 

        {% for i in 1..max %}
            {{ i }}
        {% endfor %} 


Same with your "qty" it needs to have loop index in front as well.
See the documentation link for example: 
https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#adding-multiple-purchasables-to-the-cart
Order Field:
Didn't find documentation for it in craft CMS commerce 2 docs.
Order field stores with order object. One order has one value for a unique field handle. 
You can use  in "commerce/cart/update-cart" action.
You can retrieve it by calling order.customFieldHandle.
Before you use one custom field in the twig template you need to go your control panel and create a custom field first. "http://your-site.com/admin/commerce/settings/ordersettings". Find the "order fields" (name maybe different due to the version of craft, I don't think P&T have ever changed it since beginning.) tab, and create a field just like you would create a field for entry.
Try this form:

    
    

    {{ redirectInput('cart') }}
    {{ csrfInput() }}

    {% set max = product.max %}

    {%- for purchasable in product.getVariants() -%}
        {% if purchasable.isAvailable %}
            
            
             {% for i in 1..max %}
                {{ i }}
             {% endfor %} 
            
            
        {% endif %}
    {%- endfor -%}

    {%- for purchasable in product.getVariants() -%}
        {{ purchasable|currencySalePrice('' ~ currency ~ '') }}
    {%- endfor -%}

    



If you want customer to choose one options and apply for all the purchasables.
Just put a hidden input in the for loop and then use JavaScript function to update options in the loop on change.

> **Comments:**
> **username_0**: the qty how it is is intentional, I did try your version of the select and it still hasn't worked. I find that this only works when I add an additional 'update' button, but I really want to avoid doing.  
> **username_2**: Try the form I just posted.  
> **username_0**: afraid this didn't work either :/  
> **username_2**: Can you try to add to cart again? And take a look at the storage/logs/web.log. Search for the unique value of the product/purchasable you just try add to cart. See if you can find any error.  
> **username_0**: Nothing out of the ordinary in the logs, which made me think it's not doing anything with the custom field.  

---

