How to limit country list for address form drop-down? In my store I defined list of supported billing and shipping countries at store settings. This list is respected during checkout process - limited list of countries is shown when customer is entering the address. But when user is on &quot;Address book&quot; tab of user profile page and wants to add new address list is not limited, but all countries are allowed there.
How can I limit list of displayed countries when editing address at address book user profile tab?
I tried using hook_form_alter() but I don't see country drop-down there?
Also tried hook_preprocess_input() and I see other fields, but not country drop-down.
theme_preprocess_field() didn't help either.
And of course, I didn't find that option in back-end.
Found solution here:
https://docs.drupalcommerce.org/commerce2/developer-guide/customers/addresses/countries-and-subdivisions
Created new module &quot;country_limit&quot; added event subsriber like explained there:
&lt;?php

namespace Drupal\country_limit;

use Drupal\address\Event\AddressEvents;
use Drupal\address\Event\AvailableCountriesEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class LimitCountriesEventSubscriber implements EventSubscriberInterface {

  public static function getSubscribedEvents() {
    $events[AddressEvents::AVAILABLE_COUNTRIES][] = ['onAvailableCountries'];
    return $events;
  }

  public function onAvailableCountries(AvailableCountriesEvent $event) {
    $countries = ['AT' =&gt; 'AT', 'DE' =&gt; 'DE', 'CH' =&gt; 'CH'];
    $event-&gt;setAvailableCountries($countries);
  }

}

and registered it like:
services:
  # Name of this service.
  my_config_events_subscriber:
    # Event subscriber class that will listen for the events.
    class: '\Drupal\country_limit\LimitCountriesEventSubscriber'
    # Tagged as an event_subscriber to register this subscriber with the event_dispatch service.
    tags:
      - { name: 'event_subscriber' }

Event subsriber class is directly inside &quot;src&quot; dir, since I don't have other functionalities in this module.