Answers.Body: <p>I think you can do something like;</p>
  
  <pre><code>{% if product.type('products') %}
      code to show notes field
  {% endif %}
  </code></pre>
  
  <p>See the product model docs here <a href="https://craftcommerce.com/docs/product-model" rel="nofollow noreferrer">https://craftcommerce.com/docs/product-model</a></p>
  
  <p>The note attribute <em>is</em> part of the lineitem model so you should be able to show it. </p>
  
  <p><a href="https://craftcommerce.com/docs/line-item-model#note" rel="nofollow noreferrer">https://craftcommerce.com/docs/line-item-model#note</a></p>
  
  <p>The following should work.</p>
  
  <pre><code>{% for item in order.lineitems %}
      {{ item.note }}
  {% endfor %}
  </code></pre>
  
  <p>You could try naming your input field like so;</p>
  
  <pre><code>&lt;input class="form-control" type="text" placeholder="Productsort"  name="item[note]" value="{{ item.note }}" required&gt;
  </code></pre>
  
  <p>I'd need to test this though. I've done something along these lines but can't remember exactly what I did.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-10T12:43:46.757Z
Answers.Text: That is what was my first thought too. But the note element is in the cart.lineItems and maybe that is why it is not working?
Answers.UserDisplayName: John Stevens
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-10T12:47:25.207Z
Answers.Text: I misunderstood what you were trying to do. You want to show a note that has already been added to the item within the cart view right?
Answers.UserDisplayName: foamcow
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-10T12:49:11.210Z
Answers.Text: Yes that is correct.
Answers.UserDisplayName: John Stevens
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-10T12:57:12.557Z
Answers.Text: I've updated my answer
Answers.UserDisplayName: foamcow
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-10T13:07:14.123Z
Answers.Text: Actually, you're doing it right. Is the problem that the note isn't being stored or is it simply that you are having problems with the condition to show/hide the note field?
Answers.UserDisplayName: foamcow
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-10T13:15:42.667Z
Answers.Text: Problem with the show hide. Storing of data works fine.
  When Adding that if statement, nothing is shown.
Answers.UserDisplayName: John Stevens
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-10T11:45:33.203Z
Answers.LastActivityDate: 2018-02-10T13:02:16.837Z
Answers.LastEditDate: 2018-02-10T13:02:16.837Z
Answers.UserDisplayName: foamcow
Body: <p>In my shop, I have two different kinds of products.type items and my products have variants.</p>
  
  <p>For one of products type, I would like to show the note field in the cart.</p>
  
  <p>My product types are:</p>
  
  <ul>
  <li>products </li>
  <li>options</li>
  </ul>
  
  <p>For product type options, I don't want to show the note field.</p>
  
  <p>How can I set this up? </p>
  
  <p>Tried this without success.</p>
  
  <pre><code>{% for item in cart.lineItems %}
  &lt;form method="POST"&gt;
  &lt;input type="hidden" name="action" value="commerce/cart/updateLineItem"&gt;
  &lt;input type="hidden" name="lineItemId" value="{{ item.id }}"&gt;
  
  {% if product.type('products') %}
  &lt;input class="form-control" type="text" placeholder="Productsort"  name="note" value="{{ item.note }}" required&gt;
  {% endif %}
  &lt;input class="form-control" type="submit" class="button" value="Bijwerken"/&gt;
  &lt;/form&gt;
  {% endfor %}
  </code></pre>
  
Tags: <plugin-craftcommerce>
Title: Notes field only for certain product types
ThreadText: # Notes field only for certain product types
  
  (Asked by: username_0 on 2018-02-10)
  
  In my shop, I have two different kinds of products.type items and my products have variants.
  
  For one of products type, I would like to show the note field in the cart.
  
  My product types are:
  
  * products
  * options
  
  For product type options, I don't want to show the note field.
  
  How can I set this up?
  
  Tried this without success.
  
  ```
  {% for item in cart.lineItems %}
  <form method="POST">
  <input type="hidden" name="action" value="commerce/cart/updateLineItem">
  <input type="hidden" name="lineItemId" value="{{ item.id }}">
  
  {% if product.type('products') %}
  <input class="form-control" type="text" placeholder="Productsort"  name="note" value="{{ item.note }}" required>
  {% endif %}
  <input class="form-control" type="submit" class="button" value="Bijwerken"/>
  </form>
  {% endfor %}
  
  ```
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-02-10. Score: 1
  
  I think you can do something like;
  
  ```
  {% if product.type('products') %}
      code to show notes field
  {% endif %}
  
  ```
  
  See the product model docs here <https://craftcommerce.com/docs/product-model>
  
  The note attribute *is* part of the lineitem model so you should be able to show it.
  
  <https://craftcommerce.com/docs/line-item-model#note>
  
  The following should work.
  
  ```
  {% for item in order.lineitems %}
      {{ item.note }}
  {% endfor %}
  
  ```
  
  You could try naming your input field like so;
  
  ```
  <input class="form-control" type="text" placeholder="Productsort"  name="item[note]" value="{{ item.note }}" required>
  
  ```
  
  I'd need to test this though. I've done something along these lines but can't remember exactly what I did.
  
  > **Comments:**
  > **username_0**: That is what was my first thought too. But the note element is in the cart.lineItems and maybe that is why it is not working?  
  > **username_1**: I misunderstood what you were trying to do. You want to show a note that has already been added to the item within the cart view right?  
  > **username_0**: Yes that is correct.  
  > **username_1**: I've updated my answer  
  > **username_1**: Actually, you're doing it right. Is the problem that the note isn't being stored or is it simply that you are having problems with the condition to show/hide the note field?  
  > **username_0**: Problem with the show hide. Storing of data works fine. When Adding that if statement, nothing is shown.  
  
  ---
  
  