Complete checkout for all orders Drupal commerce I am working with Drupal Commerce and Commerce Billy to generate invoices. My question is :

In Complete checkout process I want to edit all orders status to 
"Invoiced" !! .

I already created this Rules Component and it works fine. With component I can add 1 order for me(admin) and other orders to user concerned , is that make sense.

So what I want to do is : after complete checkout process I want to change all these orders status to "invoiced"

{ "rules_add_prod_to_cart_6" : {
"LABEL" : "Add Prod to cart 6",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_cart" ],
"USES VARIABLES" : { "commerce_product" : { "label" : "Commerce Product", "type" : "commerce_product" } },
"IF" : [
  { "entity_has_field" : { "entity" : [ "commerce-product" ], "field" : "field_user_concerned" } }
],
"DO" : [
  { "commerce_cart_product_add_by_sku" : {
      "USING" : {
        "user" : [ "site:current-user" ],
        "sku" : "[commerce-product:sku]\t",
        "quantity" : "1",
        "combine" : "1"
      },
      "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
    }
  },
  { "commerce_cart_product_add_by_sku" : {
      "USING" : {
        "user" : [ "commerce-product:field-user-concerned" ],
        "sku" : "[commerce-product:sku]\t",
        "quantity" : "1",
        "combine" : "1"
      },
      "PROVIDE" : { "product_add_line_item" : { "product_add_line_item2" : "Added product line item 2" } }
    }
  }
]


}
}

Example : 
SKU | Label | Price | User |

001 | Product 1 | $10 | Userexample1 |
002 | Product 2 | $40 | Userexample2 |
003 | Product 3 | $20 | Userexample1 |
004 | Product 4 | $70 | Userexample2 |

what I already done:

So after Clicking on "Add product and generate order" button :
In the above example I get 3 orders
the owner of the first order = [site:current-user] and it will return :
All Products (Product1,Product2,Product3,Product4)
The owner of the second order =  Userexample1 and it will contain 
Product1 and Product 3 
The owner of the last order = Userexample2 and it  it will contain 
Product2 and product 4 

So the order status of all those orders = Shopping cart (because we didn't complete the checkout yet), and when we complete the checkout it will change ONLY the FIRST ORDER status to "Invoiced", because [site:current-user] is the owner of it.

I want to change all the above orders status when "Complete checkout process" event is fired !

Please see images below:

After Clicking on "Add products to cart and generate orders"


"New 3 orders"


Complete checkout process 


First order status = Invoiced , BUT THE TWO OTHERS DOSEN'T CHANGE 


Is that possible ? How could I do that using Rules Module ?
I fixed this issue by adding this PHP code:


$orders = commerce_order_load_multiple(array(), array('status'=>'cart'), TRUE);
foreach($orders as $order){
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    foreach($order_wrapper->commerce_line_items as $line_item_wrapper){
        $product = $line_item_wrapper->commerce_product;
        $node_product = $node_wrapper->field_product;
            $order_wrapper->status = 'invoiced';
            $line_item_wrapper->save();
            $order_wrapper->save();
    }
}