I am writing a custom CheckoutPaneBase within Commerce 2 that incorporates shipping and billing information. My goal would be to update the customer's billing address, that is stored as billing profile, programmatically. I looked at the billing information Pane and see that they use:
$billing_profile = $this->order->getBillingProfile();
if (!$billing_profile) {
$billing_profile = $this->entityTypeManager->getStorage('profile')->create([
'type' => 'customer',
'uid' => 0,
]);
}
$billing_profile->populateFromProfile($payment_method_profile, ['data']);
$billing_profile->save();
$this->order->setBillingProfile($billing_profile);
But rather that populate from $payment_method_profile, I would like to add my own fields' values. I am not sure how I can populate an array to push to populateFromProfile or setBillingProfile or the field values.
Any help or hints?