Get all orders that contain a certain product I am trying to create a rule so that when a node containing a commerce product is update will notify all customers that have made a order containing this product.

I act on event "After updating existing content" and get to the commerce product using entity has field (field_product). 
How can I get from the product to all the orders containing it so I can loop through them?
I ended up creating a module for it as it didn't seem possible to implement using rules.

here is the function that is called on hook_node_update

//load all pending orders
$orders = commerce_order_load_multiple(array(), array('status'=&gt;'pending'), TRUE);
//go through the loaded orders
foreach($orders as $order){
    //load each order as an entity
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    foreach($order_wrapper-&gt;commerce_line_items as $line_item_wrapper){
        //check if the order contains this node's product
        $product = $line_item_wrapper-&gt;commerce_product;
        $node_product = $node_wrapper-&gt;field_product;
        if($product-&gt;sku-&gt;value() === $node_product-&gt;sku-&gt;value()){
            //change the status of the order to processing  
            $order_wrapper-&gt;status = 'processing';
            $line_item_wrapper-&gt;save();

            $order_wrapper-&gt;save();
        }
    }
}
return TRUE;


Now since I got the respective orders to processing status, I can go on using rules for the rest of the implementation.