Magento – How to get European countries list in magento 2

magento2

I have a custom checkout page for samples, Where I want to get list of European countries list in magento 2.

Best Answer

There is an option called 'European Union Countries' (general/countries/eu_countries). You can use this configuration setting to get the list of all these countries. By default, all EU-countries are selected.

Example from within a helper:

$countries = $this
    ->scopeConfig
    ->getValue(
        'general/country/eu_countries'
    );
var_dump($countries);

Outputs:

string(83) "AT,BE,BG,CY,CZ,DK,EE,FI,FR,DE,GR,HR,HU,IE,IT,LV,LT,LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,GB"
Related Topic