Right now the "customer" profile type has some special behavior:
- The address field cannot be deleted.
- The address field's "Storage settings" cannot be changed.
- The address field's "Available countries" settings is hidden (since the value is taken from the store).
We are also missing another, as revealed in #3069941: after hide all the billing address field, there is a "Edit" button.....
- The address field should always be required (meaning that the setting should always be hidden)

In the future we want to allow different profile types to be used for billing VS shipping information, for sites which have that requirement.
This will be done in #3003525: Allow shipment types to specify a profile type. But for that to happen, we need to allow all of the above special behaviors to apply to any profile type.

So, we need to:
1) Introduce a "customer_profile_type" flag set via third party settings on the profile type.
2) Disable the flag checkbox on the profile type form for the built-in "customer" profile type.
3) When the flag is set, create the address field on the bundle. And vice-versa, delete the field when the flag is unset.
4) Modify all alters to check the flag instead of hardcoding the ID of the "customer" profile type.
5) Add an AddressBook::loadTypes() method which will return all customer profile types (by filtering via flag).

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Status: Active » Needs review
Related issues: +#3059633: Provide a better addressbook UI for the user pages
StatusFileSize
new21.91 KB

Initial patch.

bojanz’s picture

StatusFileSize
new22.36 KB
new136.74 KB

Okay, looks like we're good to go.

Here's a final patch with some comment improvements (linking to the workaround for #3072156: ConfigurableFieldManager::hasData() doesn't work for address field types) and an additional test case in CustomerProfileTypeTest.

Also attaching a screenshot. The label was bikeshedded by rszrama, lisastreeter and myself. The description was added last minute by myself, trying to address some confusion raised by Lisa about the purpose of the checkbox.

  • bojanz committed f7b7839 on 8.x-2.x
    Issue #3072083 by bojanz: Allow any profile type to be used as a "...
bojanz’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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