How do I programmatically add a product reference to a commerce product node? I am trying add a commerce product to a node when a person fills out a content node. I am generating the product, but can't add it back to the node.

When I try to add the data to the node, there is no product reference field data when Do not show a widget is selected in the content type > Manage fields. 

Do not show a widget seems to remove the field from the node completely.

If I try to load in hook_node_presave():

$product = commerce_product_load_by_sku($sku);

$field_studio_pass_product = array(
  LANGUAGE_NONE =&gt; array(
    0 =&gt; array(
      'product_id' =&gt; $product-&gt;product_id,
    )
  )
);

$node-&gt;field_studio_pass_product = $field_studio_pass_product;


It won't work since there is no current field. I don't want to show the field to editor as they can't change it.

Further. This above code does work if the product field has a widget, or the ideal code:

$node_wrapper = entity_metadata_wrapper('node', $node);
$node_wrapper-&gt;field_studio_pass_product-&gt;set($product-&gt;product_id);


Again, if you set the field type to Do not show a widget there is no property on the node object, and as a result no ability to add a value.
Your issue isn't that there wasn't a field available in the data model to edit but that you used the wrong array structure for the product reference. Instead of the "value" key you should've been using "product_id".

I highly recommend against directly inserting field data like your answer proposes. The Entity / Field APIs should be allowed to perform their full jobs on this data when it's entered. For example, in your case you didn't put the necessary data into the field data revision table at the same time.