I am trying to create an instance of ‘commerce_customer_profile’ entity with all the extra fields of the customers address.
I am doing this inside a FeedsProcessor that will import users and their addresses from Magento.
I don’t want to have to create a fake $form_state array and then use field_attach_submit() as it doesn’t seem right to me.
The only other way I have found so far is:
$billing_profile = commerce_customer_profile_new('billing', $entity->uid); commerce_customer_profile_save($billing_profile); $full_billing_profile = commerce_customer_profile_load($billing_profile->profile_id);
$entity is the current user being created.
Which will then give me an empty instance of the new entity ready to populate and save but again it doesn’t feel right.
Any help appreciated.