<p>It works the same way related entries, (and all other elements) work.</p>

<p>So assuming you are on the products page, and have the <code>product</code> variable this should work:</p>

<pre><code>{% set relatedTestimonials = craft.entries.section('testimonials').relatedTo(product) %}

{% for testimonial in relatedTestimonials %}
  {{ testimonial.title }}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2016-07-21T13:26:47.467Z
2016-07-21T13:26:47.467Z
Luke Holder
<p>So I am new to Craft and I am attempting a site build with Craft Commerce.
I currently have a channel for Testimonials. Within this I have a relatedProducts field to assign products to testimonials.</p>

<p>What I am trying to achieve is to pull out the specific related testimonials on each specific product page.</p>

<p>Here is the code for my testimonials.</p>

<pre><code>{% for testimonial in craft.entries.section('testimonials') %}
&lt;blockquote class="testimonial // testimonial--large"&gt;
    {{ testimonial.body }}
    &lt;cite&gt;
        {{ testimonial.citation }}
        {% if testimonial.relatedProducts|length %}
        &lt;span class="testimonial__product"&gt;
            {% for testimonial in testimonial.relatedProducts %}
                {{ testimonial.title }}
            {% endfor %}
        &lt;/span&gt;
        {% endif %}
    &lt;/cite&gt;
&lt;/blockquote&gt;
{% endfor %}
</code></pre>

<p>Is anyone able to assist or offer some guidance on how I can achieve this?</p>

<plugin-craftcommerce>
Relating testimonials to Products
# Relating testimonials to Products

(Asked by: username_0 on 2016-07-21)

So I am new to Craft and I am attempting a site build with Craft Commerce.
I currently have a channel for Testimonials. Within this I have a relatedProducts field to assign products to testimonials.
What I am trying to achieve is to pull out the specific related testimonials on each specific product page.
Here is the code for my testimonials.
{% for testimonial in craft.entries.section('testimonials') %}

    {{ testimonial.body }}
    
        {{ testimonial.citation }}
        {% if testimonial.relatedProducts|length %}
        
            {% for testimonial in testimonial.relatedProducts %}
                {{ testimonial.title }}
            {% endfor %}
        
        {% endif %}
    

{% endfor %}

Is anyone able to assist or offer some guidance on how I can achieve this?

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_1 on 2016-07-21. Score: 3 | Accepted answer

It works the same way related entries, (and all other elements) work.
So assuming you are on the products page, and have the product variable this should work:
{% set relatedTestimonials = craft.entries.section('testimonials').relatedTo(product) %}

{% for testimonial in relatedTestimonials %}
  {{ testimonial.title }}
{% endfor %}


---

