Answers.Body: <pre><code>use craft\commerce\elements\Product;
  
  $products = Product::find()-&gt;orderStatus(1)-&gt;all();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-23T14:53:41.470Z
Answers.LastActivityDate: 2019-01-23T14:53:41.470Z
Answers.UserDisplayName: Luke Holder
Body: <p>In Commerce 1 i can select orders by a specific property as follows:</p>
  
  <pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria('Commerce_Order');
  $criteria['orderStatusId'] = 1;
  return craft()-&gt;elements-&gt;getCriteria('Commerce_Order', $criteria);
  </code></pre>
  
  <p>How can i do this in Commerce 2?</p>
  
Tags: <plugin-development><elementcriteriamodel><plugin-craftcommerce2>
Title: Getting orders by property in Commerce 2 from Plugin
ThreadText: # Getting orders by property in Commerce 2 from Plugin
  
  (Asked by: username_0 on 2019-01-23)
  
  In Commerce 1 i can select orders by a specific property as follows:
  
  ```
  $criteria = craft()->elements->getCriteria('Commerce_Order');
  $criteria['orderStatusId'] = 1;
  return craft()->elements->getCriteria('Commerce_Order', $criteria);
  
  ```
  
  How can i do this in Commerce 2?
  
  **Tags:** plugin-development, elementcriteriamodel, plugin-craftcommerce2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-23. Score: 1
  
  ```
  use craft\commerce\elements\Product;
  
  $products = Product::find()->orderStatus(1)->all();
  
  ```
  
  
  ---
  
  