How do I programmatically create an entity reference in hook_entity_info()? Is there a way to create an entity reference in hook_entity_info? I was hoping for something like the following.

'entity keys' =&gt; array(
  'id' =&gt; 'id',
  'store_ref_id' =&gt; 'store_ref_id',
), 


I have a content type store with its ID, and a new entity_type product. I would like to have a field in the new entity referenced to content type.

How can I do this?

Would it be better to re-use the already created field, which is used as reference between content types?
You can attach this field like any other:

function MY_MODULE_install() {
  // Create a field for company reference to be used by various entities
  $field = array(
    'field_name' =&gt; 'company_reference',
    'type' =&gt; 'entityreference',
    'settings' =&gt; array(
      'target_type' =&gt; 'company',
      'handler_settings' =&gt; array('target_bundles' =&gt; NULL),
    ),
    'cardinality' =&gt; 1,
    'translatable' =&gt; FALSE,
  );
  field_create_field($field);

  // Attach the company reference field to employee instance
  $instance = array(
    'field_name' =&gt; 'company_reference',
    'entity_type' =&gt; 'employee',
    'bundle' =&gt; 'employee',
    'label' =&gt; 'Company',
    'required' =&gt; false,
    'widget' =&gt; array(
      'type' =&gt; 'options_select'
    ),
    'settings' =&gt; array(
      'target_type' =&gt; 'company',
      'handler_settings' =&gt; array('target_bundles' =&gt; NULL),
    ),
    'display' =&gt; array(
      'default' =&gt; array('label' =&gt; 'inline', 'type' =&gt; 'entityreference_label'),
    ),
  );
  field_create_instance($instance);
}


Code sample taken from this more comprehensive manual.