1

I have a site with two different profiles (with different fields) where one of these are able to buy a product. In this context I want to use the same addressfield for one type in the billing information making automatic filling of a company's address.

I've tried Commerce Customer Profiles module however it seems that I am unable to merge these fields. Does anyone have some suggestions on how to use profile2 information in commerce module?

2

Profile2 and Commerce Customer Profiles are different entities.

Even if the address field is the same, the data will need to be copied over somehow.

One way to do it would be with

hook_field_attach_load

and load in the relevant address field data there, when the field is loaded.

Keep in mind:

  1. That hook can be passed multiple entities
  2. Ensure the user id for both entities is identical prior to merging the data.

More info on the Field Attach API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.