All of my products have a category field called stateCat. These state categories have a field called stateImportance. This is because some states are more important than others and I want to sort the products based on that stateImportance number. I have no idea how to do this.
This is what I've tried:
{% set products = craft.commerce.products.order('stateCat.stateImportance asc').type('coins').limit(null) %}
This doesn't seem to work, how can I accomplish this?