Problem/Motivation

A bit like #3084273: Profile fields not cleared when toggling between "Edit" and "Enter a new address" in that it's also about that same form and updating form values.
But with a different use case:

  1. assuming customer has at least 1 profile in address book
  2. assuming those profiles incomplete because they eg. were imported via a migration that (by default) lacks some validation
  3. on checkout customer selects a different profile than the one that's selected by default
  4. AJAX is running and nothing happens. The fields of the profile form are still populated with the data that was there before we selected a different profile

Proposed resolution

Always update form field values after selecting a profile from the address book.

Remaining tasks

Write a patch.

User interface changes

No extra form fields or labels or such. Only the expected values in the form fields.

API changes

None.

Data model changes

None.

Release notes snippet

Switching between incomplete profiles, at the billing information form, now shows the selected profile instead of sticking with the default profile or empty fields after having chosen "Enter a new address".

Comments

PieterDC created an issue. See original summary.

pieterdc’s picture

Title: Profile fields not cleared when toggling between "incomplete" existing profiles » Profile fields not updated when toggling between "incomplete" existing profiles

I worked around this issue by loosening up some profile field validation (which was acceptable in my use case), because then, after selecting another profile, it first shows in view mode, and when you then click the "Edit" button, the profile values ARE (updated) in the form.

pieterdc’s picture

czigor’s picture

I can confirm the issue. To clarify: You need at least 2 nonvalid profiles (e.g. postal code is too long). The bug appears when you're switching between the two profiles on checkout in the address book.

czigor’s picture

As discussed with @mglaman we need to clear user input not only when choosing "Enter a new address" in the profile select but every time we select a profile too.

Status: Needs review » Needs work

The last submitted patch, 6: commerce-3119345-incomplete_profiles_addressbook-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

czigor’s picture

Fixing tests.

Status: Needs review » Needs work
czigor’s picture

Status: Needs work » Needs review
pieterdc’s picture

Thanks for your quick follow-up!

Looking at the patch, I can imagine it would solve the issue.
I haven't tested it myself though, so I'm leaving the status at "Needs review".

  • jsacksick committed 89006de on 8.x-2.x authored by czigor
    Issue #3119345 by czigor, PieterDC: Profile fields not updated when...
jsacksick’s picture

Status: Needs review » Fixed

Committed! Thanks czigor!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.