Answers.Body: <p>If you actually have products selected in that entry's matrix products field, then</p>
  
  <pre><code>{% for block in entry.MatrixHandle %}
    {% if block.type.handle == "matrixProductsBlockTypeHandle"%}
      {% for product in block.productsFieldHandle %}
          {{ product.title }}
      {% endfor%}
    {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>That is the simplest approach really.  So if that doesn't work, triple confirm the <code>entry</code> vairable is the one you think it s and that you do indeed have chosen products in that field.  If still nothing, check the <code>craft.log</code> I guess!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-14T07:46:12.530Z
Answers.Text: Great Jeremy. I ended up doing this `{% set relatedProduct = block.matrixProductsBlockFieldHandle %} {% for product in relatedProducts %} ....` works perfectly
Answers.UserDisplayName: jjem
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-08T23:03:50.940Z
Answers.LastActivityDate: 2017-02-08T23:03:50.940Z
Answers.UserDisplayName: Jeremy Daalder
Body: <p>I use Matrix to select products through a "Commerce Products" field type.</p>
  
  <p>In the template, the following code displays nothing (not even an error in devMode.)</p>
  
  <pre><code>{% for block in entry.MatrixHandle %}
      {% set relatedProducts = craft.commerce.products.relatedTo({
          targetElement: entry, field: 'BlockTypeHandle.FieldHandle'
      }) %}
  
      {% for entry in relatedProducts %}
          {{ entry.title }}
      {% endfor %}
  
  {% endfor %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-08T18:49:54.803Z
Comments.Text: Simplify your template.  Does `{% set relatedProducts = craft.commerce.products.relatedTo({
          targetElement: entry, field: 'BlockTypeHandle.FieldHandle'
      }) %}` by itself return anything?
Comments.UserDisplayName: Brad Bell
Tags: <matrix><relations>
Title: Commerce products in Matrix
ThreadText: # Commerce products in Matrix
  
  (Asked by: username_0 on 2017-02-08)
  
  I use Matrix to select products through a "Commerce Products" field type.
  
  In the template, the following code displays nothing (not even an error in devMode.)
  
  ```
  {% for block in entry.MatrixHandle %}
      {% set relatedProducts = craft.commerce.products.relatedTo({
          targetElement: entry, field: 'BlockTypeHandle.FieldHandle'
      }) %}
  
      {% for entry in relatedProducts %}
          {{ entry.title }}
      {% endfor %}
  
  {% endfor %}
  
  ```
  
  **Tags:** matrix, relations
  
  > **Comments:**
  > **username_1**: Simplify your template.  Does `{% set relatedProducts = craft.commerce.products.relatedTo({         targetElement: entry, field: 'BlockTypeHandle.FieldHandle'     }) %}` by itself return anything?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-02-08. Score: 2 | Accepted answer
  
  If you actually have products selected in that entry's matrix products field, then
  
  ```
  {% for block in entry.MatrixHandle %}
    {% if block.type.handle == "matrixProductsBlockTypeHandle"%}
      {% for product in block.productsFieldHandle %}
          {{ product.title }}
      {% endfor%}
    {% endif %}
  {% endfor %}
  
  ```
  
  That is the simplest approach really. So if that doesn't work, triple confirm the `entry` vairable is the one you think it s and that you do indeed have chosen products in that field. If still nothing, check the `craft.log` I guess!
  
  > **Comments:**
  > **username_0**: Great username_2. I ended up doing this `{% set relatedProduct = block.matrixProductsBlockFieldHandle %} {% for product in relatedProducts %} ....` works perfectly  
  
  ---
  
  