Commerce: query products and product variations I have a view with a custom template and I need to query my products using some conditions. I'm running a videogame store, so I have a Content Type and Production Variation called "Games", and those games have a plataform assigned (Content Type field). So now I'm creating a custom PS3 categorie view and I need to query only PS3 games.

This is what I have currently:

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'commerce_product')
    -&gt;propertyCondition('status', 1)
    -&gt;propertyCondition('type', 'games')
    -&gt;fieldOrderBy('commerce_price', 'amount', 'ASC');
$result = $query-&gt;execute();


That query returns a list of "games", but I need to filter them by plataform.

PS: I don't know if any one can share information about querying products in Commerce. I have to say that Commerce API is very poorly explained.
Commerce Products are entities, so you can query them exactly like any other entity (like you're already doing). You may consider the commerce API docs for entities to be poor, but that's simply because there aren't any - you can apply standard Drupal entity logic.

It seems the only thing you're missing is the platform filter that you mention; that's just a matter of adding a field condition to the EntityFieldQuery:

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'commerce_product')
  -&gt;propertyCondition('status', 1)
  -&gt;propertyCondition('type', 'games')
  -&gt;fieldCondition('field_platform', 'value', 'PS3')
  -&gt;fieldOrderBy('commerce_price', 'amount', 'ASC');
$result = $query-&gt;execute();


Your mileage may vary if field_platform isn't a text field. For example, if it's a taxonomy term reference, you'll need to find the ID of the taxonomy term and use something like

  -&gt;fieldCondition('field_platform', 'tid', 123)


Or if it's an entity reference field you'll need the entity ID and to use something like this

  -&gt;fieldCondition('field_platform', 'target_id', 123)