<p>I'm a little unclear but I think you're looking for:</p>

<pre><code>{% set products = craft.commerce.products.type('productTypeHandle').order('postDate desc') %}
</code></pre>

CC BY-SA 3.0
2016-12-04T02:21:08.513Z
2016-12-04T07:08:32.530Z
2016-12-04T07:08:32.530Z
Luke Holder
<p>Is there a way to dynamically get all the related products based on the product type?</p>

<p>I seem to be getting all the products regardless of product type when I use:</p>

<p><code>{% set products = craft.commerce.products.relatedTo(category).order('postDate desc') %}</code></p>

<p>(obviously since I don't have any categories).</p>

<plugin-craftcommerce>
relatedTo using product type?
# relatedTo using product type?

(Asked by: username_0 on 2016-12-04)

Is there a way to dynamically get all the related products based on the product type?

I seem to be getting all the products regardless of product type when I use:

`{% set products = craft.commerce.products.relatedTo(category).order('postDate desc') %}`

(obviously since I don't have any categories).

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_1 on 2016-12-04. Score: 1 | Accepted answer

I'm a little unclear but I think you're looking for:
{% set products = craft.commerce.products.type('productTypeHandle').order('postDate desc') %}


---

