2

With Drupal 8 / Drupal Commerce 2, I need to set default values in checkout / billing information. I need to get values from connected user fields.

How could I achieve this ? In Drupal 7 I did this implementing hook_form_alter and modifying $form, but in Drupal 8 billing informations is an entity (Profile) and I can't find where to put default values.

Thanks

EDIT

I feel like in hook_form_alter I could create a new Profile entity, set fields from user fields and then set this Profile entity as default value for the billing information form. Is this correct ?

EDIT 2

There is a post about modifying the profile form (billing or shipping) in order to reload an old profile, set one as default or modifying an existing profile :

https://www.drupal.org/node/2844920

Unfortunately in my use case its useless : I allow only one billing profile, and I need to provide default values from user fields. But this will be be a great feature anyway.

Your Answer

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

Browse other questions tagged or ask your own question.