Skip to content

Instantly share code, notes, and snippets.

@kraigh
Created September 25, 2013 17:13
Show Gist options
  • Save kraigh/6702852 to your computer and use it in GitHub Desktop.
Save kraigh/6702852 to your computer and use it in GitHub Desktop.
$fax_fc = entity_create('field_collection_item', array('field_name' => 'field_fax'));
$fax_fc->setHostEntity('commerce_customer_profile', $profile);
$fax_fc_wrapper = entity_metadata_wrapper('field_collection_item', $fax_fc);
$fax_fc_wrapper->field_telephone_country_code->set($account_details['faxCountryCode']);
$fax_fc_wrapper->field_phone_fax_number->set($account_details['faxNumber']);
$fax_fc_wrapper->field_extension_code->set($account_details['faxExtension']);
$fax_fc_wrapper->save(true);
$phone_fc = entity_create('field_collection_item', array('field_name' => 'field_phone'));
$phone_fc->setHostEntity('commerce_customer_profile', $profile);
$phone_fc_wrapper = entity_metadata_wrapper('field_collection_item', $phone_fc);
$phone_fc_wrapper->field_telephone_country_code->set($account_details['phoneCountryCode']);
$phone_fc_wrapper->field_phone_fax_number->set($account_details['phoneNumber']);
$phone_fc_wrapper->field_extension_code->set($account_details['phoneExtension']);
$phone_fc_wrapper->save(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment