Answers.Body: <p>This solves my problem:</p>
  
  <pre><code>{% for block in entry.transformerProductNavigation %}
  {% set chosenCategory = block.transformer.last() %}
  
        {# set a variable – chosenCategory to the 'last' category ensuring any nested categories are accessible   #}
        &lt;a href="{{ chosenCategory.slug }}"&gt;{{ chosenCategory.title }}&lt;/a&gt;
  
  {% endfor %}
  </code></pre>
  
  <p>Thanks to this answer: <a href="https://craftcms.stackexchange.com/questions/22962/how-to-fetch-only-selected-child-category">How to fetch only selected child category?</a>. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-21T14:42:06.417Z
Answers.LastActivityDate: 2019-11-21T14:42:06.417Z
Answers.UserDisplayName: user2569
Body: <p>I'm using a matrix field to allow the author to add products they can link to category pages, but my code:</p>
  
  <pre><code>{% for block in entry.transformerProductNavigation %}
   &lt;a href="{{ block.transformer.one.url }}"&gt;{{ block.transformer.one.title }}&lt;/a&gt;
  {% endfor %}
  </code></pre>
  
  <p>outputs the parent category, can I somehow display the nested category – as you would if it was an entry field and nested entries?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-20T16:54:32.600Z
Comments.Text: With an entry field you can access the nested entries so not sure what the difference is here
Comments.UserDisplayName: user2569
Tags: <matrix><categories><nested>
Title: Link to a nested category
ThreadText: # Link to a nested category
  
  (Asked by: username_0 on 2019-11-20)
  
  I'm using a matrix field to allow the author to add products they can link to category pages, but my code:
  
  ```
  {% for block in entry.transformerProductNavigation %}
   <a href="{{ block.transformer.one.url }}">{{ block.transformer.one.title }}</a>
  {% endfor %}
  
  ```
  
  outputs the parent category, can I somehow display the nested category – as you would if it was an entry field and nested entries?
  
  **Tags:** matrix, categories, nested
  
  > **Comments:**
  > **username_0**: With an entry field you can access the nested entries so not sure what the difference is here  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-11-21. Score: 2 | Accepted answer
  
  This solves my problem:
  
  ```
  {% for block in entry.transformerProductNavigation %}
  {% set chosenCategory = block.transformer.last() %}
  
        {# set a variable – chosenCategory to the 'last' category ensuring any nested categories are accessible   #}
        <a href="{{ chosenCategory.slug }}">{{ chosenCategory.title }}</a>
  
  {% endfor %}
  
  ```
  
  Thanks to this answer: [How to fetch only selected child category?](https://craftcms.stackexchange.com/questions/22962/how-to-fetch-only-selected-child-category).
  
  
  ---
  
  