0

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.

1 Answer 1

1

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').

1
  • defaultPrice That's what I was missing. Thank you!
    – Damon
    Feb 23, 2016 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.