On the Drupal commerce 7 we have commerce_addressbook which works great but does not seem to be ported to Drupal commerce 8.2.x so we need another solution.

| Comment | File | Size | Author |
|---|---|---|---|
| #7 | multiline_profile_select.png | 173.07 KB | drugan |
| choose_address_profile.png | 157.4 KB | drugan |
Comments
Comment #2
drugan commentedThe most recent patch: https://patch-diff.githubusercontent.com/raw/drupalcommerce/commerce/pull/596.diff
The PR: https://github.com/drupalcommerce/commerce/pull/596
User can choose from earlier saved address book customer type profiles on the Payment Information pane. If the chosen profile is edited the changes are saved when going to the next step Continue to review. Also, the new profile can be created when - New Information - option is chosen.
Comment #3
bojanz commentedThere's a Profile issue that tracks this problem: #2652170: Display profiles in a profile options widget.
While looking at possible designs we ruled against a select widget because a single option can't have multiple lines, and a single line (address line 1 in your PR) is not informative enough to represent the whole profile. Hence the current standing idea to have a set of radios instead.
It should definitely be possible to implement this whole functionality as an entity reference widget, thus not touching PaymentInformation at all (and reusing it for shipping as well).
Comment #4
drugan commentedOMG, how I've missed the related issue...
OK, at least it might be used by some users before the work on #2652170: Display profiles in a profile options widget is done.
As for the radio button I am not quite agree with you because most people don't like when a page is cluttered with the information which might be not need. A regular customer usually has one or two profiles and for them it's not the issue to choose the right address from select list based on street line, moreover the default address is already populated for them. The street address line (with unique id) is enough informative and distinctive because this is just theoretically that one and the same user may have two absolutely the same street addresses let say in different cities. I don't think we need to make a solution for this almost impossible use case. But, even if some user is not sure what the particular option in the select list means they can click it and in a matter of a few microseconds they'll see the whole profile information populated by ajax in existing fields. Really, I don't understand why we need to dump all existing profiles in front of a user. What if the user is some kind of an administrator and has a hundred or a thousand profiles saved on the account?
The idea of creating reusable entity reference widget is a good one but the widget must have a choice whether to display radio buttons (rendered profile) or just a simple select list. Let's think on it together.
Comment #5
drugan commentedOops...
Comment #6
bojanz commentedI just realized that jsacksick solved the UX issue of a single-line-select by showing the full address below it. It even has an edit button
Look at commerce_addressbook 7.x-3.x:
https://www.drupal.org/files/project-images/Capture%20d%E2%80%99e%CC%81c...
https://www.drupal.org/files/project-images/Capture%20d%E2%80%99e%CC%81c...
That's what we want to build, as an entityreference field widget.
Comment #7
drugan commentedAn attempt is made to display clickable customer profiles in a multiline select element (using optgroup feature). This is not exactly what were suggested by bojanz but at least it works and may be used as an idea for further actions on the issue.
Any line clicked on the profile will display previously saved info through ajax. Basically it resolves the #2652170: Display profiles in a profile options widget as it was open because of usability of customer profile select lists on mobile devices. Which I agree has some difficulties of using such kind of a widget. Now it is more easier to tap at the desired info on any line and get the payment information kindly populated for a user.
Comment #8
bojanz commented@drugan
Definitely not. We will not be abusing the HTML standard this way.
I outlined our best plan in #6.
Comment #9
bojanz commentedThis will be resolved in #2844917: Create a commerce_profile_select form element and field widget and #2844920: Allow customer profiles to be reused.