<p>As an element, it has the same <code>order</code> criteria as entries, assets, &amp;c. So you should have no problem using <code>order('defaultPrice')</code> in your criteria. That's for price low-to-high. For high-to-low, you add <code>desc</code> to the criteria. So: <code>order('defaultPrice desc')</code>.</p>

CC BY-SA 3.0
2016-02-23T05:10:10.897Z
`defaultPrice` That's what I was missing. Thank you!
Damon
CC BY-SA 3.0
2016-02-21T13:47:03.940Z
2016-02-21T13:47:03.940Z
Bryan Redeagle
<p>I am getting a list of all products for a specific type within commerce. All is well &amp; working great.</p>

<p>I would like to know how I can dictate order. In my case, I always want the cheapest product first; the most expensive last. A perfect example would be if I were purchasing a level of membership in that "level" is a product.</p>

<p>So on my product index page:
<code>mysite.com/memberships</code></p>

<p>I want to always have the cheapest membership listed first, all the way up to the most expensive.</p>

<plugin-craftcommerce>
How can I specify order when getting all products of a given type?
# How can I specify order when getting all products of a given type?

(Asked by: username_0 on 2016-02-20)

I am getting a list of all products for a specific type within commerce. All is well & working great.

I would like to know how I can dictate order. In my case, I always want the cheapest product first; the most expensive last. A perfect example would be if I were purchasing a level of membership in that "level" is a product.

So on my product index page:
`mysite.com/memberships`

I want to always have the cheapest membership listed first, all the way up to the most expensive.

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_1 on 2016-02-21. Score: 1 | Accepted answer

As an element, it has the same `order` criteria as entries, assets, &c. So you should have no problem using `order('defaultPrice')` in your criteria. That's for price low-to-high. For high-to-low, you add `desc` to the criteria. So: `order('defaultPrice desc')`.

> **Comments:**
> **username_0**: `defaultPrice` That's what I was missing. Thank you!  

---

