Allow Customer profile address available countries configuration

Created on 7 April 2020, over 4 years ago
Updated 20 September 2024, 3 months ago

This is a request to revert a line that was part of this issue: #3072083

The line in question is:
commerce_order.module:330 (https://git.drupalcode.org/project/commerce/-/blob/8.x-2.x/modules/order...)

// Available countries are taken from the store.
$form['settings']['available_countries']['#access'] = FALSE;

The reasoning for the hiding of the available countries is clearly given in the comment, however, the available countries are only taken from the store for the address field used in the order form and not the field used in the customer profile (address book). While this may make the DX a little clearer for simple setups, it is a bad UX experience since the end user is allowed to create any address and is only later not allowed to use these addresses during checkout without any messaging to know why. Allowing the configuration of available countries for the address book field is needed.

  1. We need to account for the ability to have multiple "stores" with different configurations.
  2. Taking the store available countries list and applying them to the address book field is not easily possible because of item 1 above.
  3. Using the address module's available countries event is possible, however, that works globally for every address field in the site and so not an ideal situation.
  4. Removing the hiding of the field to allow the developer to set the allowed countries covers all use cases since the store configuration overrides what is set in the profile during checkout. If the site only has one store, the developer can set both fields to the same configuration to give a unified experience to the user. If the site has multiple store configurations, then the developer would need to make sure that the profile configuration was an inclusive set of the available countries across all stores. While this is many not be entirely obvious DX wise, I believe that UX trumps DX.
  5. That is not to say that DX is not important though, so what about adding a description help text instead of removing the available countries field configuration instead?
✨ Feature request
Status

RTBC

Version

2.0

Component

Customer

Created by

πŸ‡ΊπŸ‡ΈUnited States dragonwize

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024