Drupal commerce: Save into a customer profile field im trying to save into a customer profile field. Reading it out is no problem:

if(!empty($order_wrapper-&gt;commerce_customer_billing-&gt;field_shop_annotations)) {
$annotations = $order_wrapper-&gt;commerce_customer_billing-&gt;field_shop_annotations-&gt;value();
}


But saving into gives me an error message. Here's my code:

// Save annotations
$order = commerce_cart_order_load($user-&gt;uid);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$annotations = $form_state['values']['annotations'];

$profile_id = $order_wrapper-&gt;commerce_customer_billing-&gt;profile_id-&gt;value();

$profile = commerce_customer_profile_load($profile_id);

if ($profile_wrapper = entity_metadata_wrapper('commerce_customer_profile', $profile)) {
   // This gives me the error message:
   $profile_wrapper-&gt;commerce_customer_billing-&gt;field_shop_annotations-&gt;set('muh');
}


Everthing works fine except the set method inside the if clause. I also tried:

$profile_wrapper-&gt;commerce_customer_billing-&gt;field_shop_annotations-&gt;value = $annotations;
ok i got it:

$annotations = $form_state['values']['annotations'];
global $user;

// load oder
$order = commerce_cart_order_load($user-&gt;uid);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);

// get profile id
$profile_id = $order_wrapper-&gt;commerce_customer_billing-&gt;profile_id-&gt;value();

// load customer profile
$profile = commerce_customer_profile_load($profile_id);
if ($profile_wrapper = entity_metadata_wrapper('commerce_customer_profile', $profile)) {

       // set the value of the field and save the profile
       $profile_wrapper-&gt;field_shop_annotations-&gt;set($annotations);
       $profile_wrapper-&gt;save();

}