How to set a value on a field collection using entity metadata wrapper I'm trying to programmatically set a value on a field collection item attached to the user entity.

The field collection field in question is titled, field_user_location.

I initially had this ($usr_wrapper being an entity metadata wrapper of the user entity)

$usr_wrapper-&gt;field_user_location-&gt;field_land_phone-&gt;set($object['Phone Number']);


However that doesn't appear to work.

How do you get data onto a field collection via entity_metadata_wrapper()? There isn't much documentation about how to do this that I am seeing.
I found the documentation for field collections confusing as well.

Field collections need their own entity metadata wrapper. So, the following code would work for your example:

$collection = entity_create('field_collection_item', array('field_name' =&gt; 'field_user_location'));
$collection-&gt;setHostEntity('user', $user);
$fc_wrapper = entity_metadata_wrapper('field_collection_item', $collection);
$fc_wrapper-&gt;field_land_phone-&gt;set($object['Phone Number']);


I hope that helps for anyone else banging their heads over this.