<pre><code>use craft\commerce\elements\Product;

$products = Product::find()-&gt;orderStatus(1)-&gt;all();
</code></pre>

CC BY-SA 4.0
2019-01-23T14:53:41.470Z
2019-01-23T14:53:41.470Z
Luke Holder
<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>

<plugin-development><elementcriteriamodel><plugin-craftcommerce2>
Getting orders by property in Commerce 2 from Plugin
# 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();


---

