Score:0

How do I load the address from CiviCRM into a commerce billing profile?

km flag

I have a commerce store linked with CiviCRM. I'd like that customers only enter their address once, in the CiviCRM contact profile.

How do I load the profile to copy to a Commerce billing profile?

I have installed civicrm_entity.

These are the ways I can think of doing it:

  1. Load the CiviCRM session.

How do I get my module to load CiviCRM classes? I see that civicrm_entity loads CRM_Core_BAO_UFMatch? Or load CRM_Core_Session. We are already 'logged in' to CiviCRM so we should be able to load that session?

I'm getting class not found errors.

  1. Load the entity.

    $this->entityTypeManager->getStorage('profile')->load($account->id()); $profile_storage = $this->entityTypeManager->getStorage('profile'); $civicrm_contect = $this->entityTypeManager->getStorage('civicrm_contact') ->loadByProperties();

Properties? In the past we used email. I can't see anything in my external_identifier field, so which is best?

  1. API

This is the way we did it in the past.

If I load the CiviCRM details I have my event OrderEvents::ORDER_PAID running where I can set the billing profile details

lk flag
I would encourage you to post your question at https://civicrm.stackexchange.com if you've not already done so. Also the CiviCRM chat forum at https://chat.civicrm.org is likely to be helpful.
br flag
we have used Drupal Rules successfully in the past for this
Interlated avatar
km flag
True - so have we. Rules completely breaking 'context' and block mapping on d9. Looks like events replace rules in commerce-2.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.