Answers.Body: <p>I never used Craft Commerce but you usually store relations (no matter which) with the id - not the title. So I expect the Commerce plugin will only recognize your category with this html</p>
  
  <pre class="lang-twig prettyprint-override"><code> &lt;select id="chocOptions" name="fields[chocolateOptions][]" class="options"&gt;
        &lt;option title="selectOption"&gt;Select Option&lt;/option&gt;
        {% for category in craft.categories.group('chocolate') %}
             &lt;option value="{{ category.id }}"&gt;{{ category.title }}&lt;/option&gt;
        {% endfor %} 
   &lt;/select&gt; 
  </code></pre>
  
  <p>And you have to name your field correctly like statet <a href="https://craftcms.stackexchange.com/a/13105/5557">here</a></p>
  
  <p><strong>Edit</strong><br>
  The easiest way to get to know how you have to build your html is the following</p>
  
  <ol>
  <li>open the form in your Craft CP</li>
  <li>Right click on the field</li>
  <li>Click on "inspect" or "inspect element" or something like this</li>
  <li>Search for the input or a hidden input. When I inspect a normal relation field it looks like this</li>
  </ol>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="element small removable hasstatus" data-id="13" data-locale="de" data-status="live"
       data-label="" data-url="" data-editable=""&gt;
      &lt;!-- this is the important part --&gt;
      &lt;input type="hidden" name="fields[relation][]" value="13"&gt;
     &lt;!-- end --&gt;
      &lt;a class="delete icon" title="Entfernen"&gt;&lt;/a&gt;
      &lt;span class="status live"&gt;&lt;/span&gt;
      &lt;div class="label"&gt;
          &lt;span class="title"&gt;Some Name&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-29T14:34:24.903Z
Answers.Text: It's a normal relation field. You'll display it like every other relation in Craft. There are plenty threads how to display related entries and the docs https://craftcms.com/docs/relations#getting-target-elements-via-the-source-element
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-29T14:40:42.467Z
Answers.Text: Thank you Robin. I added the code you suggested to the product entry page...After selecting an option in the dropdown, adding the product to the cart and then viewing that cart, the customer should be able to view the selected dropdown option attributed to that product. Instead, my current code (for the cart) displays every option that could have been selected and not the particular option selected by the customer. Here is my code on the cart page:
  `{% for category in craft.categories.group('chocolate') %}
          <p>{{ category.title }}</p>
   {% endfor %}`
  Have any suggestions?
Answers.UserDisplayName: Chris Dougherty
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-29T14:41:44.580Z
Answers.Text: I already answered your question before you deleted it
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-28T18:53:47.913Z
Answers.LastActivityDate: 2017-12-28T19:04:46.163Z
Answers.LastEditDate: 2017-12-28T19:04:46.163Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I've created a form in which to specify a category for a product on the product entry page. I can't seem to add the category that the customer selects to the order model. I've checked the orders in the control panel and they do not seem to be storing the category. Does anybody know how to add a selected category to the order model?</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form id="values" method="POST"&gt; 
       &lt;input type="hidden" name="action" value="commerce/cart/updateCart"&gt;
       &lt;input type="hidden" name="redirect" value="cart"&gt;
       ...
       &lt;select id="chocOptions" name="chocolateOptions" class="options"&gt;
            &lt;option title="selectOption"&gt;Select Option&lt;/option&gt;
            {% for category in craft.categories.group('chocolate') %}
                 &lt;option value="{{ category.title }}"&gt;{{ category.title }}&lt;/option&gt;
            {% endfor %} 
       &lt;/select&gt; 
       ...
  &lt;/form&gt;
  </code></pre>
  
Tags: <plugin-craftcommerce><form><order>
Title: Product category not being added to the order model. Craft Commerce
ThreadText: # Product category not being added to the order model. Craft Commerce
  
  (Asked by: username_0 on 2017-12-28)
  
  I've created a form in which to specify a category for a product on the product entry page. I can't seem to add the category that the customer selects to the order model. I've checked the orders in the control panel and they do not seem to be storing the category. Does anybody know how to add a selected category to the order model?
  
  ```html
  <form id="values" method="POST"> 
       <input type="hidden" name="action" value="commerce/cart/updateCart">
       <input type="hidden" name="redirect" value="cart">
       ...
       <select id="chocOptions" name="chocolateOptions" class="options">
            <option title="selectOption">Select Option</option>
            {% for category in craft.categories.group('chocolate') %}
                 <option value="{{ category.title }}">{{ category.title }}</option>
            {% endfor %} 
       </select> 
       ...
  </form>
  
  ```
  
  **Tags:** plugin-craftcommerce, form, order
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-12-28. Score: 1
  
  I never used Craft Commerce but you usually store relations (no matter which) with the id - not the title. So I expect the Commerce plugin will only recognize your category with this html
  
  ```twig
   <select id="chocOptions" name="fields[chocolateOptions][]" class="options">
        <option title="selectOption">Select Option</option>
        {% for category in craft.categories.group('chocolate') %}
             <option value="{{ category.id }}">{{ category.title }}</option>
        {% endfor %} 
   </select> 
  
  ```
  
  And you have to name your field correctly like statet [here](https://craftcms.stackexchange.com/a/13105/5557)
  
  **Edit**  
  The easiest way to get to know how you have to build your html is the following
  
  1. open the form in your Craft CP
  2. Right click on the field
  3. Click on "inspect" or "inspect element" or something like this
  4. Search for the input or a hidden input. When I inspect a normal relation field it looks like this
  
  ```html
  <div class="element small removable hasstatus" data-id="13" data-locale="de" data-status="live"
       data-label="" data-url="" data-editable="">
      <!-- this is the important part -->
      <input type="hidden" name="fields[relation][]" value="13">
     <!-- end -->
      <a class="delete icon" title="Entfernen"></a>
      <span class="status live"></span>
      <div class="label">
          <span class="title">Some Name</span>
      </div>
  </div>
  
  ```
  
  > **Comments:**
  > **username_1**: It's a normal relation field. You'll display it like every other relation in Craft. There are plenty threads how to display related entries and the docs https://craftcms.com/docs/relations#getting-target-elements-via-the-source-element  
  > **username_0**: Thank you username_1. I added the code you suggested to the product entry page...After selecting an option in the dropdown, adding the product to the cart and then viewing that cart, the customer should be able to view the selected dropdown option attributed to that product. Instead, my current code (for the cart) displays every option that could have been selected and not the particular option selected by the customer. Here is my code on the cart page: `{% for category in craft.categories.group('chocolate') %}         <p>{{ category.title }}</p>  {% endfor %}` Have any suggestions?  
  > **username_1**: I already answered your question before you deleted it  
  
  ---
  
  