What are all the available options that products can be ordered by?

craft.commerce.products({ order: '???' })

I have found this reference https://craftcommerce.com/docs/products-fields#templating but it does not list the available options.

Bonus points if it includes the key that sorts by sales (aka popularity).

1 Answer 1


When you call craft.commerce.products you're asking Craft for an Commerce_ProductModel.

So you could sort by:

  • title (alpha)
  • defaultPrice
  • type
  • promotable (sale products on top)
  • postDate (newest products)
  • .. etc.

To sort by sales (popularity), you might consider something like BonFire's Popular Products plugin which keeps track of how many purchases were made and how many times the product was viewed, very similar to Ben Croker's EntryCount plugin.

  • Glad it was helpful! Commented Oct 7, 2017 at 21:22

Your Answer

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

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