How to change a field value to 500 products (commerce module) at the same time? I have about 500 product in my site powered by the commerce module. I need stock capabilities so installed the commerce_stock module. So far so good. 

This module add a stock field and a checkbox to check Disable stock for this product in the product itself. 

Thing is that stock field is set to 0,00 by default, then all the product are shown as Out of stock.

The solution is as simple as to mark the checkbox to check Disable stock for this product for all products. But I have 500 products, then this will be a waste of time...

Is there any way to do this programmatically? Any other idea to get this done?

I thing of doing this directly in the database with a sql query, but not sure if this is a good idea?
Well I can come out of two ways of doing this. One of them is Using the commerce API which is really good you just have to get all your 500 products with the following method:

 $query=new EntityFieldQuery;

    $query= $query-&gt;entityCondition('entity_type','commerce_product')-&gt;execute();

    foreach($query as $entity){
       $entity-&gt;commerce_stock[LANGUAGE_NONE][0]['value'] = 1;
       commerce_product_save($new_product);
    }


Or you can also do it on the database updating the value of the table field_data_commerce_stock:

update field_data_commerce_stock set commerce_stock_value=ANY_NUMBER;