Answers.Body: <p>You could set a variable to access the products model like so:</p>
  
  <p><code>{% set product = item.purchasable.product %}</code></p>
  
  <p>and then access the fields like normal <code>{{ product.myCustomField }}</code></p>
  
  <p>The <code>snapshot</code> holds the products fields as they were at the time the line item was added to the cart. So depending on how you're using the fields would dictate the method used. </p>
  
  <p>You could also access the snapshot slightly cleaner using 
  <code>{{ item.snapshot.product.myCustomField }}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-16T14:40:45.180Z
Answers.LastActivityDate: 2016-05-16T14:45:53.377Z
Answers.LastEditDate: 2016-05-16T14:45:53.377Z
Answers.UserDisplayName: Luke Pearce
Body: <p>How would I access a custom product field in the cart. I did it with the <a href="https://craftcommerce.com/docs/line-item-model#snapshot" rel="nofollow">snapshot</a> attribute like so:</p>
  
  <pre><code>{# cart.html #}
  
  {% for item in cart.lineItems %}
    {{ craft.commerce.products.id(item.snapshot.product.id).first().myCustomField }}
  {% endfor %}
  </code></pre>
  
  <p>But is that the right way to do it?</p>
  
Tags: <plugin-craftcommerce><custom-field>
Title: Display custom product field in cart
ThreadText: # Display custom product field in cart
  
  (Asked by: username_0 on 2016-05-16)
  
  How would I access a custom product field in the cart. I did it with the [snapshot](https://craftcommerce.com/docs/line-item-model#snapshot) attribute like so:
  
  ```
  {# cart.html #}
  
  {% for item in cart.lineItems %}
    {{ craft.commerce.products.id(item.snapshot.product.id).first().myCustomField }}
  {% endfor %}
  
  ```
  
  But is that the right way to do it?
  
  **Tags:** plugin-craftcommerce, custom-field
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-16. Score: 6 | Accepted answer
  
  You could set a variable to access the products model like so:
  
  `{% set product = item.purchasable.product %}`
  
  and then access the fields like normal `{{ product.myCustomField }}`
  
  The `snapshot` holds the products fields as they were at the time the line item was added to the cart. So depending on how you're using the fields would dictate the method used.
  
  You could also access the snapshot slightly cleaner using
  `{{ item.snapshot.product.myCustomField }}`
  
  
  ---
  
  