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?

Issue fork commerce-3125801

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dragonwize created an issue. See original summary.

dragonwize’s picture

Status: Active » Needs review
StatusFileSize
new818 bytes

Status: Needs review » Needs work
dragonwize’s picture

Status: Needs work » Needs review
StatusFileSize
new1.65 KB

Fixed test.

sajithathukorala’s picture

Status: Needs review » Reviewed & tested by the community

Tested and worked fine ,

capysara’s picture

Patch works as expected and is very useful information.

matthiasm11’s picture

+1 for patch #4. Thanks!

damien laguerre’s picture

Applied the patch on Drupal 10.3.5 + commerce 2.40 and everything works fine.
Very useful, thank you!

anybody’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
Status: Reviewed & tested by the community » Needs work

Could someone please create a MR against 3.0.x from this? Thanks!

sorabh.v6 made their first commit to this issue’s fork.

sorabh.v6’s picture

Version: 3.0.x-dev » 3.x-dev

sorabh.v6’s picture